X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=tests%2Frun_tests.py;h=ecd47dd4347e39e0ac98a492e8f0c327329bfb49;hb=2966ecdb8c49266d491a1f75791868920d68a510;hp=c96f882bb3d76306a2932aeb01d047b177fea456;hpb=59cae873b00e3459d9a7f794398894c95ab682ed;p=python_utils.git diff --git a/tests/run_tests.py b/tests/run_tests.py index c96f882..ecd47dd 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -27,7 +27,7 @@ import text_utils import thread_utils logger = logging.getLogger(__name__) -args = config.add_commandline_args(f'({__file__})', 'Args related to __file__') +args = config.add_commandline_args(f'({__file__})', f'Args related to {__file__}') args.add_argument('--unittests', '-u', action='store_true', help='Run unittests.') args.add_argument('--doctests', '-d', action='store_true', help='Run doctests.') args.add_argument('--integration', '-i', action='store_true', help='Run integration tests.') @@ -141,6 +141,7 @@ class TestRunner(ABC, thread_utils.ThreadWithReturnValue): tests_timed_out=[], ) self.tests_started = 0 + self.lock = threading.Lock() @abstractmethod def get_name(self) -> str: @@ -149,7 +150,8 @@ class TestRunner(ABC, thread_utils.ThreadWithReturnValue): def get_status(self) -> Tuple[int, TestResults]: """Ask the TestRunner for its status.""" - return (self.tests_started, self.test_results) + with self.lock: + return (self.tests_started, self.test_results) @abstractmethod def begin(self, params: TestingParameters) -> TestResults: @@ -403,13 +405,12 @@ def code_coverage_report(): """Give a final code coverage report.""" text_utils.header('Code Coverage') exec_utils.cmd('coverage combine .coverage*') - out = exec_utils.cmd('coverage report --omit=config-3.8.py,*_test.py,*_itest.py --sort=-cover') + out = exec_utils.cmd('coverage report --omit=config-3.*.py,*_test.py,*_itest.py --sort=-cover') print(out) print( - """ -To recall this report w/o re-running the tests: + """To recall this report w/o re-running the tests: - $ coverage report --omit=config-3.8.py,*_test.py,*_itest.py --sort=-cover + $ coverage report --omit=config-3.*.py,*_test.py,*_itest.py --sort=-cover ...from the 'tests' directory. Note that subsequent calls to run_tests.py with --coverage will klobber previous results. See: