diff --git a/tests/unit/test_attach.py b/tests/unit/test_attach.py index ea29a5566a..31c8693bb7 100644 --- a/tests/unit/test_attach.py +++ b/tests/unit/test_attach.py @@ -26,13 +26,15 @@ class TestAttachSubCommandOptions: @pytest.mark.parametrize( "option", [ - "--native", - "--force", - "-f", - "--aggregate", - "--follow-fork", - "--trace-python-allocators", - "--no-compress", + ["--output", "foo"], + ["-o", "foo"], + ["--native"], + ["--force"], + ["-f"], + ["--aggregate"], + ["--follow-fork"], + ["--trace-python-allocators"], + ["--no-compress"], ], ) def test_memray_attach_stop_tracking_option_with_other_options( @@ -40,12 +42,11 @@ def test_memray_attach_stop_tracking_option_with_other_options( ): # WHEN with pytest.raises(SystemExit): - main(["attach", "1234", "--stop-tracking", option]) + main(["attach", "1234", "--stop-tracking", *option]) captured = capsys.readouterr() - assert ( - "Can't use --stop-tracking with" in captured.err and option in captured.err - ) + assert "Can't use --stop-tracking with" in captured.err + assert option[0] in captured.err.split() @pytest.mark.parametrize( "arg1,arg2", @@ -69,17 +70,3 @@ def test_memray_attach_stop_tracking_option_with_other_mode_options( f"argument {arg2_name}: not allowed with argument {arg1_name}" in captured.err ) - - @pytest.mark.parametrize( - "option, argument", - [("--output", "test.bin")], - ) - def test_memray_attach_stop_tracking_option_with_output_options( - self, option, argument, capsys - ): - # WHEN - with pytest.raises(SystemExit): - main(["attach", "1234", "--stop-tracking", option, argument]) - - captured = capsys.readouterr() - assert f"Can't use --stop-tracking with {option}" in captured.err