|
3 | 3 | from manage import commands |
4 | 4 |
|
5 | 5 |
|
6 | | -def test_help_with_error_command(assert_log, monkeypatch): |
| 6 | +def test_pymanager_help_command(assert_log): |
| 7 | + cmd = commands.HelpCommand([commands.HelpCommand.CMD], None) |
| 8 | + cmd.execute() |
| 9 | + assert_log( |
| 10 | + assert_log.skip_until(r"Python installation manager \d+\.\d+.*"), |
| 11 | + assert_log.skip_until(".*pymanager-pytest exec -V.*"), |
| 12 | + assert_log.skip_until(".*pymanager-pytest exec -3.*"), |
| 13 | + assert_log.skip_until(".*pymanager-pytest install.*"), |
| 14 | + assert_log.skip_until(".*pymanager-pytest list.*"), |
| 15 | + assert_log.skip_until(".*pymanager-pytest uninstall.*"), |
| 16 | + ) |
| 17 | + |
| 18 | + |
| 19 | +def test_py_help_command(assert_log, monkeypatch): |
| 20 | + monkeypatch.setattr(commands, "EXE_NAME", "py") |
| 21 | + cmd = commands.HelpCommand([commands.HelpCommand.CMD], None) |
| 22 | + cmd.execute() |
| 23 | + assert_log( |
| 24 | + assert_log.skip_until(r"Python installation manager \d+\.\d+.*"), |
| 25 | + assert_log.skip_until(".*pymanager-pytest -V.*"), |
| 26 | + assert_log.skip_until(".*pymanager-pytest -3.*"), |
| 27 | + assert_log.skip_until(".*py install.*"), |
| 28 | + assert_log.skip_until(".*py list.*"), |
| 29 | + assert_log.skip_until(".*py uninstall.*"), |
| 30 | + ) |
| 31 | + |
| 32 | + |
| 33 | +def test_help_with_error_command(assert_log): |
7 | 34 | expect = secrets.token_hex(16) |
8 | 35 | cmd = commands.HelpWithErrorCommand( |
9 | 36 | [commands.HelpWithErrorCommand.CMD, expect, "-v", "-q"], |
10 | 37 | None |
11 | 38 | ) |
12 | | - monkeypatch.setattr(commands, "WELCOME", "") |
13 | 39 | cmd.execute() |
14 | 40 | assert_log( |
15 | | - assert_log.skip_until(rf".*Unknown command: pymanager-pytest {expect} -v -q.*"), |
| 41 | + assert_log.skip_until(f".*Unknown command: pymanager-pytest {expect} -v -q.*"), |
16 | 42 | r"Python installation manager \d+\.\d+.*", |
17 | | - assert_log.skip_until(rf"The command .*?pymanager-pytest {expect} -v -q.*"), |
| 43 | + assert_log.skip_until(f"The command .*?pymanager-pytest {expect} -v -q.*"), |
18 | 44 | ) |
19 | 45 |
|
20 | 46 |
|
|
0 commit comments