You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fix test expectation in test_flags_missing_selector #74
However, DocFilter.add_flags() defines a mutually exclusive argument group with required=True. When none of the required options (--all, --slug, or --first) is provided, argparse raises SystemExit with exit code 2, rather than argparse.ArgumentError.
This means the current test does not match the actual behavior of argparse.
Suggested fix
The test should be updated to expect SystemExit and verify that the exit code is 2:
with self.assertRaises(SystemExit) as context:
parser.parse_args(args=[])
self.assertEqual(context.exception.code, 2)
The full test suite was also run locally, and all 64 tests passed.
QA workflow is only about QA. Tests are run in the tests workflow.
Thank you for pointing this out. I hadn't checked the separate tests workflow, so I was wrong about the tests not being run in CI. Sorry for the confusion.
I'll update the issue to remove the CI part and keep only the test failure, since the CI concern was based on my misunderstanding of the existing workflows.
I don't get the rest of the issue. Do you mean that tests are currently failing on the main branch?
As for the test failure, yes, test_flags_missing_selector fails on the current main branch. The test expects argparse.ArgumentError, but argparse actually raises SystemExit with exit code 2 when the required mutually exclusive arguments are missing.
I've fixed the expectation in PR #75 and ran the full test suite locally. All 64 tests passed.
changed the title [-]Fix test expectation and consider running Python tests in CI[/-][+]Fix test expectation in test_flags_missing_selector[/+]on Nov 27, 2026
Answered in #75 — this isn't a test bug. The missing-required-group error raises argparse.ArgumentError rather than SystemExit on Python 3.12+, and pyproject.toml requires >=3.12,<3.13; SystemExit: 2 is the 3.11 behaviour. Full suite is 64 passed on main under 3.12.15. Please double-check the Python version your hatch env resolved to.
I've added a more detailed explanation of the Python version discrepancy in #75 (review), including the relevant CPython changes and the project's Python version requirements.
Activity
benoit74 commentedon Nov 26, 2026
QA workflow is only about QA. Tests are run in the tests workflow.
I don't get the rest of the issue. Do you mean that tests are currently failing on the
mainbranch?byMeysaM commentedon Nov 27, 2026
@benoit74
Thank you for pointing this out. I hadn't checked the separate tests workflow, so I was wrong about the tests not being run in CI. Sorry for the confusion.
I'll update the issue to remove the CI part and keep only the test failure, since the CI concern was based on my misunderstanding of the existing workflows.
As for the test failure, yes,
test_flags_missing_selectorfails on the currentmainbranch. The test expectsargparse.ArgumentError, butargparseactually raisesSystemExitwith exit code 2 when the required mutually exclusive arguments are missing.I've fixed the expectation in PR #75 and ran the full test suite locally. All 64 tests passed.
[-]Fix test expectation and consider running Python tests in CI[/-][+]Fix test expectation in test_flags_missing_selector[/+]benoit74 commentedon Nov 30, 2026
Answered in #75 — this isn't a test bug. The missing-required-group error raises
argparse.ArgumentErrorrather thanSystemExiton Python 3.12+, andpyproject.tomlrequires>=3.12,<3.13;SystemExit: 2is the 3.11 behaviour. Full suite is64 passedonmainunder 3.12.15. Please double-check the Python version your hatch env resolved to.byMeysaM commentedon Dec 2, 2026
I've added a more detailed explanation of the Python version discrepancy in #75 (review), including the relevant CPython changes and the project's Python version requirements.