Skip to content

Commit 00dcd94

Browse files
authored
Merge pull request #1440 from yedayak/delete-extra-makefile
Move deletion of extra makefile to fixture, don't do it on macos
2 parents 5b171c6 + f6476ad commit 00dcd94

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

test/t/test_make.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
11
import os
2+
import sys
23

34
import pytest
45

56
from conftest import assert_complete
67

78

89
class TestMake:
10+
@pytest.fixture
11+
def remove_extra_makefile(self, bash):
12+
yield
13+
# For some reason macos make doesn't actually create extra_makefile
14+
if sys.platform != "darwin":
15+
os.remove(f"{bash.cwd}/make/extra_makefile")
16+
917
@pytest.mark.complete("make -f Ma", cwd="make")
1018
def test_1(self, completion):
1119
assert completion == "kefile"
1220

1321
@pytest.mark.complete("make .", cwd="make", require_cmd=True)
14-
def test_2(self, bash, completion):
22+
def test_2(self, bash, completion, remove_extra_makefile):
1523
"""Hidden targets."""
1624
assert completion == ".cache/ .test_passes".split()
17-
os.remove(f"{bash.cwd}/make/extra_makefile")
1825

1926
@pytest.mark.complete("make .cache/", cwd="make", require_cmd=True)
20-
def test_3(self, bash, completion):
27+
def test_3(self, bash, completion, remove_extra_makefile):
2128
assert completion == ".cache/1 .cache/2".split()
22-
os.remove(f"{bash.cwd}/make/extra_makefile")
2329

2430
@pytest.mark.complete("make ", cwd="shared/empty_dir")
2531
def test_4(self, completion):
@@ -30,24 +36,20 @@ def test_5(self, completion):
3036
assert completion
3137

3238
@pytest.mark.complete("make ", cwd="make", require_cmd=True)
33-
def test_6(self, bash, completion):
39+
def test_6(self, bash, completion, remove_extra_makefile):
3440
assert completion == "all clean extra_makefile install sample".split()
35-
os.remove(f"{bash.cwd}/make/extra_makefile")
3641

3742
@pytest.mark.complete("make .cache/.", cwd="make", require_cmd=True)
38-
def test_7(self, bash, completion):
43+
def test_7(self, bash, completion, remove_extra_makefile):
3944
assert completion == ".cache/.1 .cache/.2".split()
40-
os.remove(f"{bash.cwd}/make/extra_makefile")
4145

4246
@pytest.mark.complete("make -C make ", require_cmd=True)
43-
def test_8(self, bash, completion):
47+
def test_8(self, bash, completion, remove_extra_makefile):
4448
assert completion == "all clean extra_makefile install sample".split()
45-
os.remove(f"{bash.cwd}/make/extra_makefile")
4649

4750
@pytest.mark.complete("make -nC make ", require_cmd=True)
48-
def test_8n(self, bash, completion):
51+
def test_8n(self, bash, completion, remove_extra_makefile):
4952
assert completion == "all clean extra_makefile install sample".split()
50-
os.remove(f"{bash.cwd}/make/extra_makefile")
5153

5254
@pytest.mark.complete("make -", require_cmd=True)
5355
def test_9(self, completion):

0 commit comments

Comments
 (0)