Add --all and cleanup clear_line().
authorScott Gasch <[email protected]>
Fri, 3 Jun 2022 15:21:52 +0000 (08:21 -0700)
committerScott Gasch <[email protected]>
Fri, 3 Jun 2022 15:21:52 +0000 (08:21 -0700)
ansi.py
tests/run_tests.py

diff --git a/ansi.py b/ansi.py
index a8b84fc0c2dd0acce18e96d21d86eb2b2da409b7..628fed7144442cd5b7d13b7d136ac0fc66532d7f 100755 (executable)
--- a/ansi.py
+++ b/ansi.py
@@ -1619,6 +1619,11 @@ def clear_screen() -> str:
     return "\e[H\e[2J"
 
 
+def clear_line() -> str:
+    """Clear the current line ANSI escape sequence"""
+    return "\e[2K\r"
+
+
 def reset() -> str:
     """Reset text attributes to 'normal'"""
     return "\e[m"
index 6f4b399e0e65286e9860fe92376746575dfc297a..fa75539cc22b058358b73f05e98a1ac29602f918 100755 (executable)
@@ -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('\e[2K\rFinal Report:')
+    print(f'{ansi.clear_line()}Final Report:')
     if config.config['coverage']:
         code_coverage_report()
     total_problems = test_results_report(results)