mirror of
https://github.com/henrydcase/pqc.git
synced 2024-11-26 17:31:38 +00:00
14 lines
598 B
Python
14 lines
598 B
Python
import subprocess
|
|
|
|
def run_subprocess(command, working_dir, expected_returncode = 0):
|
|
"""Helper function to run a shell command and report success/failure depending on the exit status of the shell command."""
|
|
# Note we need to capture stdout/stderr from the subprocess, then print it, which nose/unittest will then capture and buffer appropriately
|
|
result = subprocess.run(
|
|
command,
|
|
stdout = subprocess.PIPE,
|
|
stderr = subprocess.STDOUT,
|
|
cwd = working_dir
|
|
)
|
|
print(result.stdout.decode('utf-8'))
|
|
assert(result.returncode == expected_returncode)
|