Skip to content

Commit

Permalink
Fix test failure in Python 3.14a
Browse files Browse the repository at this point in the history
Due to recent changes in argparse error message construction the test
that is checking for the non-existing split algorithm was failing.
python/cpython#117766

Fixed with a lenient error string check with additional dynamic algorithm
check.
  • Loading branch information
dogukancagatay committed Nov 14, 2024
1 parent 9cfb51f commit a8337b5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import pytest
from _pytest.main import ExitCode # type: ignore[attr-defined]
from pytest_split.algorithms import Algorithms

pytest_plugins = ["pytester"]

Expand Down Expand Up @@ -353,10 +354,11 @@ def test_returns_nonzero_when_invalid_algorithm_name(self, example_suite, capsys
assert result.ret == ExitCode.USAGE_ERROR

outerr = capsys.readouterr()
assert (
"argument --splitting-algorithm: invalid choice: 'NON_EXISTENT' "
"(choose from 'duration_based_chunks', 'least_duration')"
) in outerr.err
for err_content in [
"argument --splitting-algorithm: invalid choice: 'NON_EXISTENT' ",
*Algorithms.names(),
]:
assert err_content in outerr.err


class TestHasExpectedOutput:
Expand Down

0 comments on commit a8337b5

Please sign in to comment.