Skip to content

Commit 4a9f001

Browse files
committed
Update makefile and test runner for CI
1 parent 5316b75 commit 4a9f001

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

Makefile

+11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# These targets are not files
2+
.PHONY: contribute ci test i18n
3+
14
contribute:
25
# Create a sandbox installation for playing around with oscar.
36
python setup.py develop
@@ -10,6 +13,14 @@ contribute:
1013
sandbox/manage.py oscar_import_catalogue_images sandbox/data/books-images.tar.gz
1114
sandbox/manage.py loaddata countries.json sandbox/fixtures/pages.json
1215

16+
ci:
17+
# Run continous tests and generate lint reports
18+
python setup.py develop
19+
pip install -r requirements.txt
20+
#./runtests.py --with-coverage
21+
pyflakes oscar | perl -ple "s/: /: [E] /" | grep -v migrations > violations.txt
22+
pep8 --exclude="migrations" oscar | perl -ple 's/: [WE](\d+)/: [W$1]/' > violations.txt
23+
1324
test:
1425
./runtests.py
1526

runtests.py

+13-4
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,23 @@ def run_tests(*test_args):
2020

2121
if __name__ == '__main__':
2222
parser = OptionParser()
23-
__, args = parser.parse_args()
23+
parser.add_option('--with-coverage', dest='coverage', default=False,
24+
action='store_true')
25+
parser.add_option('--with-xunit', dest='xunit', default=False,
26+
action='store_true')
27+
options, args = parser.parse_args()
2428

2529
# If no args, then use 'progressive' plugin to keep the screen real estate
2630
# used down to a minimum. Otherwise, use the spec plugin
2731
nose_args = ['-s', '-x',
2832
'--with-progressive' if not args else '--with-spec']
29-
#nose_args.extend([
30-
# '--with-coverage', '--cover-package=oscar', '--cover-html',
31-
# '--cover-html-dir=htmlcov'])
33+
34+
if options.coverage:
35+
# Nose automatically uses any options passed to runtests.py, which is
36+
# why the coverage trigger uses '--with-coverage' and why we don't need
37+
# to explicitly include it here.
38+
nose_args.extend([
39+
'--cover-package=oscar', '--cover-html',
40+
'--cover-html-dir=htmlcov'])
3241
configure(nose_args)
3342
run_tests(*args)

0 commit comments

Comments
 (0)