Skip to content

Commit

Permalink
fix(tests): fix a test broken in Python 3.12.8 (#595)
Browse files Browse the repository at this point in the history
Since 3.12.8, argparse 'choices' are no longer quoted.
Ref: python/cpython#11776

---------

Co-authored-by: Alex Lowe <[email protected]>
  • Loading branch information
tigarmo and lengau authored Dec 13, 2024
1 parent 94f1bdb commit 689aac6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/integration/commands/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"""Tests for init command."""
import os
import pathlib
import sys
import textwrap

import pytest
Expand Down Expand Up @@ -122,7 +123,12 @@ def test_init_name(app, capsys, monkeypatch, project_dir, expected_file):
@pytest.mark.usefixtures("fake_template_dirs")
def test_init_invalid_profile(app, capsys, monkeypatch):
"""Give a helpful error message for invalid profiles."""
expected_error = "Error: argument --profile: invalid choice: 'bad' (choose from 'other-template', 'simple')"
choices = "other-template, simple"
if sys.version_info < (3, 12, 8):
choices = "'other-template', 'simple'"
expected_error = (
f"Error: argument --profile: invalid choice: 'bad' (choose from {choices})"
)
monkeypatch.setattr("sys.argv", ["testcraft", "init", "--profile", "bad"])

return_code = app.run()
Expand Down

0 comments on commit 689aac6

Please sign in to comment.