fork/mons

git clone https://git.julia.blue/fork/mons

coloursofnoiseUse .NET Core Celeste.dll on all platforms702009d

fixes
2.5 KiB75 linesraw
1import os
2
3import outputs
4import pytest
5
6from mons.mons import cli as mons_cli
7
8
9@pytest.mark.prioritize
10@pytest.mark.must_pass  # All other tests rely on `mons add`
11def test_add(runner_result, test_install_path, test_name):
12    with runner_result(mons_cli, ["add", test_name, test_install_path]) as result:
13        assert result.exit_code == 0
14        assert outputs.FOUND_INSTALL in result.output
15
16
17def test_add_fail(runner_result, test_name, tmp_path):
18    fake_path = os.path.join(tmp_path, "fake_path")
19    with runner_result(mons_cli, ["add", test_name, fake_path]) as result:
20        assert result.exception
21        assert f"Path '{fake_path}' does not exist" in result.output
22
23    os.mkdir(fake_path)
24    with runner_result(mons_cli, ["add", test_name, fake_path]) as result:
25        assert result.exception
26        asm = "'Celeste.exe' or 'Celeste.dll'"
27        assert f"{asm} could not be found" in result.output
28
29
30def test_rename(runner_result, test_install):
31    with runner_result(
32        mons_cli, ["rename", test_install, f"{test_install}_renamed"]
33    ) as result:
34        assert result.exit_code == 0
35        assert outputs.RENAMED_INSTALL in result.output
36
37
38def test_set_path(runner_result, test_install, test_install_path):
39    with runner_result(
40        mons_cli, ["set-path", test_install, test_install_path]
41    ) as result:
42        assert result.exit_code == 0
43        assert outputs.FOUND_INSTALL in result.output
44
45
46def test_remove(runner_result, test_install):
47    with runner_result(mons_cli, ["remove", test_install, "--force"]) as result:
48        assert result.exit_code == 0
49        assert outputs.REMOVED_INSTALL in result.output
50
51
52def test_list(runner_result, test_install):
53    with runner_result(mons_cli, ["list"]) as result:
54        assert result.exit_code == 0
55        assert test_install in result.output
56
57
58def test_list_empty(runner_result):
59    with runner_result(mons_cli, ["list"]) as result:
60        assert result.exit_code != 0, result.output
61        assert outputs.NO_INSTALLS_FOUND in result.output
62
63
64def test_show(runner_result, test_install):
65    with runner_result(mons_cli, ["show", test_install]) as result:
66        assert result.exit_code == 0, result.output
67        assert test_install in result.output
68
69
70def test_launch(runner_result, test_install, test_install_path):
71    with runner_result(mons_cli, ["launch", test_install, "--dry-run"]) as result:
72        assert result.exit_code == 0, result.output
73        assert (
74            os.path.join(os.path.dirname(test_install_path), "Celeste") in result.output
75        )