diff --git a/test/t/test_make.py b/test/t/test_make.py index 34fc7e5906a..4af4285b665 100644 --- a/test/t/test_make.py +++ b/test/t/test_make.py @@ -1,4 +1,5 @@ import os +import sys import pytest @@ -6,20 +7,25 @@ class TestMake: + @pytest.fixture + def remove_extra_makefile(self, bash): + yield + # 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): 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 +36,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):