Skip to content

Commit

Permalink
Run CI tests for Python 3.12 and 3.13 (#139)
Browse files Browse the repository at this point in the history
* Run CI tests for Python 3.12 and 3.13

Signed-off-by: Fabrice Normandin <[email protected]>

* Simplify and fix test for invalid commands

Signed-off-by: Fabrice Normandin <[email protected]>

---------

Signed-off-by: Fabrice Normandin <[email protected]>
  • Loading branch information
lebrice authored Dec 19, 2024
1 parent e413b54 commit be3ce2b
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
max-parallel: 4
matrix:
platform: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
env:
PLATFORM: ${{ matrix.platform }}
steps:
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
max-parallel: 5
matrix:
platform: [ubuntu-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']

# For the action to work, you have to supply a mysql
# service as defined below.
Expand Down
21 changes: 13 additions & 8 deletions tests/cli/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,21 @@ def test_help(

@requires_no_s_flag
@pytest.mark.parametrize(
"command",
("command", "expected_error"),
[
"mila", # Error: Missing a subcommand.
"mila search conda",
"mila code --boo", # Error: Unknown argument.
"mila serve", # Error: Missing the subcommand.
"mila forward", # Error: Missing the REMOTE argument.
("mila", "the following arguments are required: <command>"),
("mila search conda", "invalid choice: 'search'"),
("mila code --boo", "unrecognized arguments: --boo"),
(
"mila serve",
"error: the following arguments are required: <serve_subcommand>",
),
("mila forward", "error: the following arguments are required: REMOTE"),
],
)
def test_invalid_command_output(
command: str,
file_regression: FileRegressionFixture,
expected_error: str,
monkeypatch: pytest.MonkeyPatch,
):
"""Test that we get a proper output when we use an invalid command (that exits
Expand All @@ -82,7 +85,9 @@ def test_invalid_command_output(
SystemExit
), contextlib.redirect_stdout(buf), contextlib.redirect_stderr(buf):
main()
file_regression.check(_convert_argparse_output_to_pre_py311_format(buf.getvalue()))
assert expected_error in buf.getvalue()
# The output changes between python versions.
# file_regression.check(_convert_argparse_output_to_pre_py311_format(buf.getvalue()))


@pytest.mark.parametrize(
Expand Down
3 changes: 0 additions & 3 deletions tests/cli/test_commands/test_invalid_command_output_mila_.txt

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit be3ce2b

Please sign in to comment.