Skip to content

Commit

Permalink
Add test for CLI --exec output matching direct execution output
Browse files Browse the repository at this point in the history
  • Loading branch information
brianschubert committed Sep 11, 2023
1 parent 84d5d16 commit 325e8dc
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions test/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,28 @@ def test_bad_path() -> None:
sixs_cli.main(["--path"])


@pytest.mark.parametrize("version", sixs_bin._SIXS_BINARIES.keys())
def test_exec_eof(version) -> None:
def test_exec_matches(sixs_version, manual_input_file) -> None:
"""
Verify that output when using ``--exec`` exactly matches the output of directly
calling the binary.
"""
proc_args = {
"input": manual_input_file,
"capture_output": True,
"check": True,
"text": True,
"encoding": "ascii",
}

direct_result = subprocess.run([sixs_bin.get_path(sixs_version)], **proc_args)

cli_result = _run_self_subprocess(["--exec", sixs_version], **proc_args)

assert direct_result.returncode == cli_result.returncode
assert direct_result.stdout == cli_result.stdout
assert direct_result.stderr == cli_result.stderr


def test_exec_eof(sixs_version) -> None:
"""Check error message on empty input file."""
with pytest.raises(subprocess.CalledProcessError) as exec_info:
Expand Down

0 comments on commit 325e8dc

Please sign in to comment.