From 62646099a0fc34e3790ad554f7e902991beff4bc Mon Sep 17 00:00:00 2001 From: Yedaya Katsman Date: Fri, 4 Jul 2025 14:33:47 +0300 Subject: [PATCH 1/2] test(make): Move file deletion to a fixture --- test/t/test_make.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/test/t/test_make.py b/test/t/test_make.py index 34fc7e5906a..e1014ccf63b 100644 --- a/test/t/test_make.py +++ b/test/t/test_make.py @@ -6,20 +6,23 @@ class TestMake: + @pytest.fixture + def remove_extra_makefile(self, bash): + yield + os.remove(f"{bash.cwd}/make/extra_makefile") + @pytest.mark.complete("make -f Ma", cwd="make") def test_1(self, completion): assert completion == "kefile" @pytest.mark.complete("make .", cwd="make", require_cmd=True) - def test_2(self, bash, completion): + def test_2(self, bash, completion, remove_extra_makefile): """Hidden targets.""" assert completion == ".cache/ .test_passes".split() - os.remove(f"{bash.cwd}/make/extra_makefile") @pytest.mark.complete("make .cache/", cwd="make", require_cmd=True) - def test_3(self, bash, completion): + def test_3(self, bash, completion, remove_extra_makefile): assert completion == ".cache/1 .cache/2".split() - os.remove(f"{bash.cwd}/make/extra_makefile") @pytest.mark.complete("make ", cwd="shared/empty_dir") def test_4(self, completion): @@ -30,24 +33,20 @@ def test_5(self, completion): assert completion @pytest.mark.complete("make ", cwd="make", require_cmd=True) - def test_6(self, bash, completion): + def test_6(self, bash, completion, remove_extra_makefile): assert completion == "all clean extra_makefile install sample".split() - os.remove(f"{bash.cwd}/make/extra_makefile") @pytest.mark.complete("make .cache/.", cwd="make", require_cmd=True) - def test_7(self, bash, completion): + def test_7(self, bash, completion, remove_extra_makefile): assert completion == ".cache/.1 .cache/.2".split() - os.remove(f"{bash.cwd}/make/extra_makefile") @pytest.mark.complete("make -C make ", require_cmd=True) - def test_8(self, bash, completion): + def test_8(self, bash, completion, remove_extra_makefile): assert completion == "all clean extra_makefile install sample".split() - os.remove(f"{bash.cwd}/make/extra_makefile") @pytest.mark.complete("make -nC make ", require_cmd=True) - def test_8n(self, bash, completion): + def test_8n(self, bash, completion, remove_extra_makefile): assert completion == "all clean extra_makefile install sample".split() - os.remove(f"{bash.cwd}/make/extra_makefile") @pytest.mark.complete("make -", require_cmd=True) def test_9(self, completion): From f6476adc33a7c0ad067f85b47d40f26934ffc66f Mon Sep 17 00:00:00 2001 From: Yedaya Katsman Date: Fri, 4 Jul 2025 15:46:33 +0300 Subject: [PATCH 2/2] test(macos): Don't delete extra_makefile on macos For some reason, even though the test succeeds, the actual file isn't created like on linux. Maybe about versions/implementations of make? --- test/t/test_make.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/t/test_make.py b/test/t/test_make.py index e1014ccf63b..4af4285b665 100644 --- a/test/t/test_make.py +++ b/test/t/test_make.py @@ -1,4 +1,5 @@ import os +import sys import pytest @@ -9,7 +10,9 @@ class TestMake: @pytest.fixture def remove_extra_makefile(self, bash): yield - os.remove(f"{bash.cwd}/make/extra_makefile") + # For some reason macos make doesn't actually create extra_makefile + if sys.platform != "darwin": + os.remove(f"{bash.cwd}/make/extra_makefile") @pytest.mark.complete("make -f Ma", cwd="make") def test_1(self, completion):