From b0d4fb3055f2b4bb70d3dcb9df0a92db76423ed4 Mon Sep 17 00:00:00 2001 From: "Gabriel F. T. Gomes" Date: Sat, 11 Jan 2025 13:46:18 -0800 Subject: [PATCH] test(unit): workaround for function definition in command offset test If the first item in test2 is not executed, for example with the following diff: @@ -55,7 +55,6 @@ class TestUnitCommandOffset: @pytest.mark.parametrize( "cmd,expected_completion", [ - ("cmd2", wordlist), ("cmd3", wordlist), ("cmd4", []), ("cmd5", ["0"]), test_cmd_quoted fails with the following error message: def test_cmd_quoted(self, bash, functions): > assert assert_complete(bash, "meta 'cmd2' ") == self.wordlist E AssertionError: assert == ['bar', 'foo'] E E Full diff: E + E - [ E - 'bar', E - 'foo', E - ] This means that test_cmd_quoted depends on the previous execution of test2. When executed serially, this issue does not manifest itself. However, with parallel execution it might, dependending on the scheduling of the tests. This patch adds a workaround to test_cmd_quoted, so that it executes the required subcommand of test2 prior to its own test. --- test/t/unit/test_unit_command_offset.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/t/unit/test_unit_command_offset.py b/test/t/unit/test_unit_command_offset.py index 0e32c1f8076..039b5e30bc8 100644 --- a/test/t/unit/test_unit_command_offset.py +++ b/test/t/unit/test_unit_command_offset.py @@ -97,6 +97,7 @@ def test_3(self, bash, functions, cmd, expected_completion): assert got == expected_completion def test_cmd_quoted(self, bash, functions): + assert assert_complete(bash, "meta cmd2 ") == self.wordlist assert assert_complete(bash, "meta 'cmd2' ") == self.wordlist def test_cmd_specialchar(self, bash, functions):