diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index bb2498f6..30e5f7be 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -29,3 +29,5 @@ jobs: python -m unittest tests/*.py coverage combine coverage report + env: + TESTS_DEBUG: 1 diff --git a/tests/test_utils.py b/tests/test_utils.py index a3c82027..c0faf324 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,16 +1,28 @@ # SPDX-License-Identifier: GPL-2.0 +import os import subprocess +import time class RunSubprocessMixin: + def is_debug_enabled(self): + return "TESTS_DEBUG" in os.environ + def run_subprocess(self, args): + begin = time.time() + if self.is_debug_enabled(): + print("TEST_CALL", args) proc = subprocess.Popen( args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, ) out, err = proc.communicate() + if self.is_debug_enabled(): + print("TEST_CALL completed", time.time() - begin) + print("STDOUT:", out.decode('utf-8')) + print("STDERR:", err.decode('utf-8')) return out, err, proc.returncode def run_subprocess_assert_returncode(self, args, expected_returncode=0):