10
10
11
11
assert 'TOXTEMPDIR' in os .environ , "you must run these tests using tox"
12
12
13
+
13
14
@pytest .fixture (autouse = True )
14
15
def autouse_tmpdir (config_tmpdir , west_init_tmpdir ):
15
16
# Since this module tests west's configuration file features,
16
17
# adding autouse=True to the config_tmpdir and west_init_tmpdir fixtures
17
18
# saves typing and is less error-prone than using it below in every test case.
18
19
pass
19
20
21
+
20
22
def test_alias_commands ():
21
23
cmd ('config alias.test1 topdir' )
22
24
cmd ('config --global alias.test2 topdir' )
@@ -28,6 +30,7 @@ def test_alias_commands():
28
30
assert cmd ('test2' ) == topdir_out
29
31
assert cmd ('test3' ) == topdir_out
30
32
33
+
31
34
def test_alias_help ():
32
35
cmd ('config alias.test topdir' )
33
36
@@ -36,13 +39,15 @@ def test_alias_help():
36
39
assert "An alias that expands to: topdir" in help_out
37
40
assert cmd ('-h test' ) == help_out
38
41
42
+
39
43
def test_alias_recursive_commands ():
40
44
list_format = '{revision} TESTALIAS {name}'
41
45
cmd (['config' , 'alias.test1' , f'list -f "{ list_format } "' ])
42
46
cmd ('config alias.test2 test1' )
43
47
44
48
assert cmd ('test2' ) == cmd (['list' , '-f' , list_format ])
45
49
50
+
46
51
def test_alias_infinite_recursion ():
47
52
cmd ('config alias.test1 test2' )
48
53
cmd ('config alias.test2 test3' )
@@ -53,6 +58,7 @@ def test_alias_infinite_recursion():
53
58
54
59
assert 'unknown command "test1";' in str (excinfo .value .stdout )
55
60
61
+
56
62
def test_alias_empty ():
57
63
cmd (['config' , 'alias.empty' , '' ])
58
64
@@ -64,18 +70,21 @@ def test_alias_empty():
64
70
65
71
assert 'empty alias "empty"' in str (excinfo .value .stdout )
66
72
73
+
67
74
def test_alias_early_args ():
68
75
cmd ('config alias.test1 topdir' )
69
76
70
77
# An alias with an early command argument shouldn't fail
71
78
assert "Replacing alias test1 with ['topdir']" in cmd ('-v test1' )
72
79
80
+
73
81
def test_alias_command_with_arguments ():
74
82
list_format = '{revision} TESTALIAS {name}'
75
83
cmd (['config' , 'alias.revs' , f'list -f "{ list_format } "' ])
76
84
77
85
assert cmd ('revs' ) == cmd (['list' , '-f' , list_format ])
78
86
87
+
79
88
def test_alias_override ():
80
89
before = cmd ('list' )
81
90
list_format = '{name} : {revision}'
0 commit comments