Selaa lähdekoodia

Update makefile and test runner for CI

master
David Winterbottom 13 vuotta sitten
vanhempi
commit
4a9f0019c8
2 muutettua tiedostoa jossa 24 lisäystä ja 4 poistoa
  1. 11
    0
      Makefile
  2. 13
    4
      runtests.py

+ 11
- 0
Makefile Näytä tiedosto

1
+# These targets are not files
2
+.PHONY: contribute ci test i18n
3
+
1
 contribute:
4
 contribute:
2
 	# Create a sandbox installation for playing around with oscar.
5
 	# Create a sandbox installation for playing around with oscar.
3
 	python setup.py develop
6
 	python setup.py develop
10
 	sandbox/manage.py oscar_import_catalogue_images sandbox/data/books-images.tar.gz
13
 	sandbox/manage.py oscar_import_catalogue_images sandbox/data/books-images.tar.gz
11
 	sandbox/manage.py loaddata countries.json sandbox/fixtures/pages.json
14
 	sandbox/manage.py loaddata countries.json sandbox/fixtures/pages.json
12
 
15
 
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
+
13
 test:
24
 test:
14
 	./runtests.py
25
 	./runtests.py
15
 
26
 

+ 13
- 4
runtests.py Näytä tiedosto

20
 
20
 
21
 if __name__ == '__main__':
21
 if __name__ == '__main__':
22
     parser = OptionParser()
22
     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()
24
 
28
 
25
     # If no args, then use 'progressive' plugin to keep the screen real estate
29
     # If no args, then use 'progressive' plugin to keep the screen real estate
26
     # used down to a minimum.  Otherwise, use the spec plugin
30
     # used down to a minimum.  Otherwise, use the spec plugin
27
     nose_args = ['-s', '-x',
31
     nose_args = ['-s', '-x',
28
                  '--with-progressive' if not args else '--with-spec']
32
                  '--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'])
32
     configure(nose_args)
41
     configure(nose_args)
33
     run_tests(*args)
42
     run_tests(*args)

Loading…
Peruuta
Tallenna