Add TOX_PYDEV_DEBUG env variable to run_tests.py

Add new env variable to handle test cases
execution when debugging test cases under a
debugger by using testools.run runner.

Change-Id: Ia6ec38e6471d93dd98c3fef17e66e9187c666c9d
This commit is contained in:
Federico Ressi
2020-10-09 14:25:54 +02:00
parent e07c36d8f4
commit 3df2bb87f1
2 changed files with 45 additions and 3 deletions

View File

@@ -21,8 +21,6 @@ import sys
import subprocess
TOP_DIR = os.path.dirname(os.path.dirname(__file__))
if TOP_DIR not in sys.path:
sys.path.insert(0, TOP_DIR)
@@ -53,6 +51,10 @@ TOX_REPORT_XML = os.environ.get(
TOX_RUN_TESTS_TIMEOUT = float(os.environ.get('TOX_RUN_TESTS_TIMEOUT') or 0.)
TOX_PYDEV_DEBUG = bool(
os.environ.get('TOX_PYDEV_DEBUG', 'false').lower() in
['true', 'yes', '1'])
def main():
common.setup_logging()
@@ -75,6 +77,10 @@ def run_tests():
cleanup_report_dir()
log_environ()
if TOX_PYDEV_DEBUG:
debug_test_cases()
return True
succeeded = True
try:
run_test_cases()
@@ -149,6 +155,12 @@ def log_tests_results():
check=False)
def debug_test_cases():
common.execute_python('-m testtools.run {posargs}',
posargs=common.get_posargs(),
capture_stdout=False)
def run_test_cases():
common.execute('stestr run --slowest {posargs}',
posargs=common.get_posargs(),