Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: improve the run_macaron.sh script #521

Merged
merged 10 commits into from
Oct 24, 2023
18 changes: 14 additions & 4 deletions scripts/dev_scripts/test_run_macaron_sh.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

"""Tests for the ``run_macaron.sh`` script."""

import os
import subprocess
import sys
from collections import namedtuple
Expand Down Expand Up @@ -32,22 +33,31 @@ def test_macaron_command() -> int:
]

exit_code = 0
env = dict(os.environ)
env["MCN_DEBUG_ARGS"] = "1"

for test_case in test_cases:
name, script_args, expected_macaron_args = test_case
print(f"test_macaron_command[{name}]:", end=" ")

result = subprocess.run(
[
"scripts/release_scripts/run_macaron.sh",
*script_args,
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
env={"MCN_DEBUG_ARGS": "1"},
check=True,
env=env,
check=False,
)
resulting_macaron_args = list(result.stderr.decode("utf-8").split())
if result.returncode != 0:
exit_code = 1
print(f"FAILED with exit code {exit_code}")
print("stderr:")
print(result.stderr.decode("utf-8"))
continue

print(f"test_macaron_command[{name}]:", end=" ")
resulting_macaron_args = list(result.stderr.decode("utf-8").split())

if resulting_macaron_args != expected_macaron_args:
print("FAILED")
Expand Down
Loading
Loading