Fix bug 1090277: Add crontab tests to main test-suite.

This commit is contained in:
Paul McLanahan 2014-10-28 11:24:57 -04:00
Родитель 0364eda68d
Коммит 97dd9c58da
6 изменённых файлов: 34 добавлений и 5 удалений

3
.gitmodules поставляемый
Просмотреть файл

@ -55,3 +55,6 @@
[submodule "vendor-local/src/icalendar"] [submodule "vendor-local/src/icalendar"]
path = vendor-local/src/icalendar path = vendor-local/src/icalendar
url = git://github.com/collective/icalendar.git url = git://github.com/collective/icalendar.git
[submodule "vendor-local/src/chkcrontab"]
path = vendor-local/src/chkcrontab
url = git://github.com/lyda/chkcrontab.git

Просмотреть файл

@ -3,9 +3,6 @@ python:
- "2.6" - "2.6"
before_script: before_script:
- flake8 bedrock lib - flake8 bedrock lib
- chkcrontab etc/cron.d/bedrock-prod
- chkcrontab etc/cron.d/bedrock-stage
- chkcrontab etc/cron.d/bedrock-dev
- mysql -e 'create database bedrock_test;' - mysql -e 'create database bedrock_test;'
- python manage.py syncdb --noinput --migrate - python manage.py syncdb --noinput --migrate
- python manage.py update_product_details - python manage.py update_product_details
@ -14,7 +11,6 @@ script: coverage run manage.py test
before_install: before_install:
- git submodule update --init --recursive - git submodule update --init --recursive
install: install:
- pip install unittest2
- pip install -r requirements/dev.txt - pip install -r requirements/dev.txt
after_success: after_success:
# Report coverage results to coveralls.io # Report coverage results to coveralls.io

29
bedrock/base/tests.py Normal file
Просмотреть файл

@ -0,0 +1,29 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import glob
import chkcrontab_lib as chkcrontab
from funfactory.settings_base import path
from bedrock.mozorg.tests import TestCase
CRONTAB_FILES = glob.glob(path('etc', 'cron.d', '*'))
class TestCrontabFiles(TestCase):
def test_crontab_files_have_newlines(self):
"""Crontab files should end with newline character."""
for filename in CRONTAB_FILES:
with open(filename) as cronfile:
self.assertTrue(cronfile.read().endswith('\n'),
'No newline at end of ' + filename)
def test_crontab_files_valid(self):
"""Crontab files should pass validation."""
for filename in CRONTAB_FILES:
cronlog = chkcrontab.LogCounter()
return_value = chkcrontab.check_crontab(filename, cronlog)
self.assertEqual(return_value, 0, 'Problem with ' + filename)

Просмотреть файл

@ -12,7 +12,6 @@ mock==1.0.1
pyquery==1.0 pyquery==1.0
factory_boy==2.2.1 factory_boy==2.2.1
coverage==3.6 coverage==3.6
chkcrontab==1.6
# L10n # L10n
translate-toolkit==1.8.0 translate-toolkit==1.8.0

@ -0,0 +1 @@
Subproject commit d4cbe2cada94b3868b3c2ae0e97a35a5d76c9d8e

Просмотреть файл

@ -23,3 +23,4 @@ src/tweepy
src/mdx_outline src/mdx_outline
src/legal-docs src/legal-docs
src/icalendar/src src/icalendar/src
src/chkcrontab