mirror of
https://github.com/containers/podman-compose.git
synced 2025-04-26 02:18:42 +02:00
tests: Add verbose debug option via env variable
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
This commit is contained in:
parent
c84b4c33fc
commit
27c8cebbdc
2
.github/workflows/pytest.yml
vendored
2
.github/workflows/pytest.yml
vendored
@ -29,3 +29,5 @@ jobs:
|
|||||||
python -m unittest tests/*.py
|
python -m unittest tests/*.py
|
||||||
coverage combine
|
coverage combine
|
||||||
coverage report
|
coverage report
|
||||||
|
env:
|
||||||
|
TESTS_DEBUG: 1
|
||||||
|
@ -1,16 +1,28 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
|
|
||||||
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import time
|
||||||
|
|
||||||
|
|
||||||
class RunSubprocessMixin:
|
class RunSubprocessMixin:
|
||||||
|
def is_debug_enabled(self):
|
||||||
|
return "TESTS_DEBUG" in os.environ
|
||||||
|
|
||||||
def run_subprocess(self, args):
|
def run_subprocess(self, args):
|
||||||
|
begin = time.time()
|
||||||
|
if self.is_debug_enabled():
|
||||||
|
print("TEST_CALL", args)
|
||||||
proc = subprocess.Popen(
|
proc = subprocess.Popen(
|
||||||
args,
|
args,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE,
|
stderr=subprocess.PIPE,
|
||||||
)
|
)
|
||||||
out, err = proc.communicate()
|
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
|
return out, err, proc.returncode
|
||||||
|
|
||||||
def run_subprocess_assert_returncode(self, args, expected_returncode=0):
|
def run_subprocess_assert_returncode(self, args, expected_returncode=0):
|
||||||
|
Loading…
Reference in New Issue
Block a user