tools: tweak depsolve() helper to show stderr from depsolve

So that we see any error output during the tests in "realtime". With
subprocess check=True and capture_output=True on exit_code != 0 no
stderr as part of the exception by default so this change helps
seeing issues from depsolve-dnf more easily.
This commit is contained in:
Michael Vogt 2024-04-04 15:05:32 +02:00 committed by Brian C. Lane
parent ffeb0169ff
commit f892351b00

View file

@ -5,6 +5,7 @@ import os
import pathlib
import socket
import subprocess as sp
import sys
from tempfile import TemporaryDirectory
import pytest
@ -41,9 +42,7 @@ def depsolve(pkgs, repos, root_dir, cache_dir, command):
]
}
}
p = sp.run([command], input=json.dumps(req).encode(), check=True, capture_output=True)
if p.stderr:
print(p.stderr.decode())
p = sp.run([command], input=json.dumps(req).encode(), check=True, stdout=sp.PIPE, stderr=sys.stderr)
return json.loads(p.stdout.decode())