Commit 405e0aa06fe8a8702e32d2f181a5e5f699a4dfea
Committed by
Matheus de Sousa Faria
1 parent
0c61dbf4
Exists in
master
and in
4 other branches
Allowing run a specific test suite
- Works for tests/run.py Signed-off-by: Matheus Faria <matheus.sousa.faria@gmail.com> Signed-off-by: TomazMartins <tomaz.r.martins@gmail.com>
Showing
1 changed file
with
16 additions
and
5 deletions
Show diff stats
tests/run.py
... | ... | @@ -16,23 +16,34 @@ import coverage |
16 | 16 | |
17 | 17 | from django.conf import settings |
18 | 18 | from django.test.utils import get_runner |
19 | +import colab.settings | |
19 | 20 | |
20 | 21 | |
21 | -def runtests(): | |
22 | +def runtests(test_suites=[]): | |
22 | 23 | if django.VERSION >= (1, 7, 0): |
23 | 24 | django.setup() |
24 | 25 | |
25 | 26 | test_runner = get_runner(settings) |
26 | - failures = test_runner(interactive=False, failfast=False).run_tests([]) | |
27 | + failures = test_runner(interactive=False, failfast=False).run_tests( | |
28 | + test_suites) | |
27 | 29 | sys.exit(failures) |
28 | 30 | |
29 | 31 | |
30 | -def run_with_coverage(): | |
32 | +def run_with_coverage(test_suites=[]): | |
31 | 33 | if os.path.exists('.coverage'): |
32 | 34 | os.remove('.coverage') |
33 | 35 | coverage.process_startup() |
34 | - runtests() | |
36 | + runtests(test_suites) | |
35 | 37 | |
36 | 38 | |
37 | 39 | if __name__ == '__main__': |
38 | - run_with_coverage() | |
40 | + all_valid_apps = True | |
41 | + | |
42 | + for arg in sys.argv[1:]: | |
43 | + if arg not in colab.settings.INSTALLED_APPS: | |
44 | + print arg + " App not found" | |
45 | + print "Try colab." + arg | |
46 | + all_valid_apps = False | |
47 | + | |
48 | + if all_valid_apps: | |
49 | + run_with_coverage(sys.argv[1:]) | ... | ... |