Przeglądaj źródła

Update makefile and test runner for CI

master
David Winterbottom 13 lat temu
rodzic
commit
4a9f0019c8
2 zmienionych plików z 24 dodań i 4 usunięć
  1. 11
    0
      Makefile
  2. 13
    4
      runtests.py

+ 11
- 0
Makefile Wyświetl plik

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

+ 13
- 4
runtests.py Wyświetl plik

@@ -20,14 +20,23 @@ def run_tests(*test_args):
20 20
 
21 21
 if __name__ == '__main__':
22 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 29
     # If no args, then use 'progressive' plugin to keep the screen real estate
26 30
     # used down to a minimum.  Otherwise, use the spec plugin
27 31
     nose_args = ['-s', '-x',
28 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 41
     configure(nose_args)
33 42
     run_tests(*args)

Ładowanie…
Anuluj
Zapisz