Last change
on this file since afb311e was
9e308a3,
checked in by Paul Kienzle <pkienzle@…>, 7 years ago
|
tweak utests so it is slightly easier to identify and run failing tests
|
-
Property mode set to
100755
|
File size:
1.0 KB
|
Rev | Line | |
---|
[6fe5100] | 1 | #!/usr/bin/env python |
---|
[aaf5e49] | 2 | from __future__ import print_function |
---|
[6fe5100] | 3 | |
---|
| 4 | import os |
---|
| 5 | import sys |
---|
| 6 | import xmlrunner |
---|
| 7 | import unittest |
---|
| 8 | import imp |
---|
| 9 | from os.path import abspath, dirname, split as splitpath, join as joinpath |
---|
| 10 | |
---|
[c155a16] | 11 | import logging |
---|
[463e7ffc] | 12 | logger = logging.getLogger(__name__) |
---|
[64ca561] | 13 | if not logger.root.handlers: |
---|
| 14 | import logging.config |
---|
| 15 | LOGGER_CONFIG_FILE = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'logging.ini') |
---|
| 16 | logging.config.fileConfig(LOGGER_CONFIG_FILE, disable_existing_loggers=False) |
---|
| 17 | |
---|
[aaad4c95] | 18 | if len(sys.argv) < 2: |
---|
| 19 | logger.error("Use %s <filename to test>",sys.argv[0]) |
---|
| 20 | sys.exit(-1) |
---|
[c155a16] | 21 | |
---|
[6fe5100] | 22 | run_py = joinpath(dirname(dirname(abspath(__file__))), 'run.py') |
---|
| 23 | run = imp.load_source('sasview_run', run_py) |
---|
| 24 | run.prepare() |
---|
| 25 | #print "\n".join(sys.path) |
---|
[76f132a] | 26 | test_path,test_file = splitpath(abspath(sys.argv[1])) |
---|
[aaf5e49] | 27 | print("=== testing:",sys.argv[1]) |
---|
[6fe5100] | 28 | #print test_path, test_file |
---|
| 29 | sys.argv = [sys.argv[0]] |
---|
| 30 | os.chdir(test_path) |
---|
| 31 | sys.path.insert(0, test_path) |
---|
| 32 | test = imp.load_source('tests',test_file) |
---|
| 33 | unittest.main(test, testRunner=xmlrunner.XMLTestRunner(output='logs')) |
---|
Note: See
TracBrowser
for help on using the repository browser.