From a1d5f347e978bdb62666a90f55c36047e82ed5cf Mon Sep 17 00:00:00 2001 From: Scott Gasch Date: Fri, 3 Jun 2022 08:21:52 -0700 Subject: [PATCH] Add --all and cleanup clear_line(). --- ansi.py | 5 +++++ tests/run_tests.py | 14 ++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ansi.py b/ansi.py index a8b84fc..628fed7 100755 --- a/ansi.py +++ b/ansi.py @@ -1619,6 +1619,11 @@ def clear_screen() -> str: return "" +def clear_line() -> str: + """Clear the current line ANSI escape sequence""" + return "\r" + + def reset() -> str: """Reset text attributes to 'normal'""" return "" diff --git a/tests/run_tests.py b/tests/run_tests.py index 6f4b399..fa75539 100755 --- a/tests/run_tests.py +++ b/tests/run_tests.py @@ -31,6 +31,12 @@ args = config.add_commandline_args(f'({__file__})', '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.') +args.add_argument( + '--all', + '-a', + action='store_true', + help='Run unittests, doctests and integration tests. Equivalient to -u -d -i', +) args.add_argument( '--coverage', '-c', action='store_true', help='Run tests and capture code coverage data' ) @@ -347,13 +353,13 @@ def main() -> Optional[int]: logger.debug('Clearing existing coverage data via "coverage erase".') exec_utils.cmd('coverage erase') - if config.config['unittests']: + if config.config['unittests'] or config.config['all']: saw_flag = True threads.append(UnittestTestRunner(params)) - if config.config['doctests']: + if config.config['doctests'] or config.config['all']: saw_flag = True threads.append(DoctestTestRunner(params)) - if config.config['integration']: + if config.config['integration'] or config.config['all']: saw_flag = True threads.append(IntegrationTestRunner(params)) @@ -412,7 +418,7 @@ def main() -> Optional[int]: ) time.sleep(0.5) - print('\rFinal Report:') + print(f'{ansi.clear_line()}Final Report:') if config.config['coverage']: code_coverage_report() total_problems = test_results_report(results) -- 2.45.2