1
1
import os
2
+ import sys
2
3
3
4
import pytest
4
5
5
6
from conftest import assert_complete
6
7
7
8
8
9
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
+
9
17
@pytest .mark .complete ("make -f Ma" , cwd = "make" )
10
18
def test_1 (self , completion ):
11
19
assert completion == "kefile"
12
20
13
21
@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 ):
15
23
"""Hidden targets."""
16
24
assert completion == ".cache/ .test_passes" .split ()
17
- os .remove (f"{ bash .cwd } /make/extra_makefile" )
18
25
19
26
@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 ):
21
28
assert completion == ".cache/1 .cache/2" .split ()
22
- os .remove (f"{ bash .cwd } /make/extra_makefile" )
23
29
24
30
@pytest .mark .complete ("make " , cwd = "shared/empty_dir" )
25
31
def test_4 (self , completion ):
@@ -30,24 +36,20 @@ def test_5(self, completion):
30
36
assert completion
31
37
32
38
@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 ):
34
40
assert completion == "all clean extra_makefile install sample" .split ()
35
- os .remove (f"{ bash .cwd } /make/extra_makefile" )
36
41
37
42
@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 ):
39
44
assert completion == ".cache/.1 .cache/.2" .split ()
40
- os .remove (f"{ bash .cwd } /make/extra_makefile" )
41
45
42
46
@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 ):
44
48
assert completion == "all clean extra_makefile install sample" .split ()
45
- os .remove (f"{ bash .cwd } /make/extra_makefile" )
46
49
47
50
@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 ):
49
52
assert completion == "all clean extra_makefile install sample" .split ()
50
- os .remove (f"{ bash .cwd } /make/extra_makefile" )
51
53
52
54
@pytest .mark .complete ("make -" , require_cmd = True )
53
55
def test_9 (self , completion ):
0 commit comments