/
test_custom.py
56 lines (44 loc) · 1.19 KB
/
test_custom.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
def test_command(cmd, project):
project.write_devyml("""
commands:
mycmd:
run: touch somefile
""")
cmd.run("bud mycmd")
project.assert_file('somefile')
def test_command_short_syntax(cmd, project):
project.write_devyml("""
commands:
mycmd: touch somefile
""")
cmd.run("bud mycmd")
project.assert_file('somefile')
def test_run_in_project_dir(cmd, project):
project.write_devyml("""
commands:
mycmd:
run: touch somefile
""")
cmd.run('mkdir subdir')
cmd.run('cd subdir')
cmd.run("bud mycmd")
project.assert_file('somefile')
def test_exit_code(cmd, project):
project.write_devyml("""
commands:
success:
run: 'true'
failure:
run: 'false'
""")
cmd.run("bud success")
cmd.run("bud failure", expect_exit_code=1)
def test_with_arguments(cmd, project):
project.write_devyml("""
commands:
mycmd:
run: echo PREFIX
""")
output = cmd.run("bud mycmd ARG1 ARG2")
lines = [l for l in output.splitlines() if not l.startswith("🐼")]
assert ["PREFIX ARG1 ARG2"] == lines