Skip to content

Fix tests for setuptools >= 70 which removed tests_require#21

Merged
toabctl merged 2 commits intomasterfrom
fix/setuptools-70-tests-require
Mar 10, 2026
Merged

Fix tests for setuptools >= 70 which removed tests_require#21
toabctl merged 2 commits intomasterfrom
fix/setuptools-70-tests-require

Conversation

@toabctl
Copy link
Copy Markdown
Owner

@toabctl toabctl commented Mar 10, 2026

Summary

  • setuptools >= 70 removed the tests_require attribute from Distribution objects as part of the deprecation of python setup.py test
  • The extraction code in metaextract.py already handles this correctly via hasattr() guards — when the attribute is absent, it's simply omitted from the output
  • The tests were the problem: they unconditionally asserted tests_require would be present in the extracted metadata
  • Added a runtime feature probe (_HAS_TESTS_REQUIRE) that checks whether the installed setuptools actually has the attribute, and conditionally includes it in test expectations

This ensures tests pass on both setuptools < 70 (where tests_require is present) and >= 70 (where it's removed).

Test plan

  • All 17 tests pass with setuptools 82.0.1 (>= 70, no tests_require)
  • Verify tests also pass with setuptools < 70 (e.g. 69.1.1) where tests_require is still present

Fixes #20

toabctl added 2 commits March 10, 2026 08:04
setuptools >= 70 removed the tests_require attribute from Distribution
objects as part of the deprecation of `python setup.py test`. The
extraction code already handles this gracefully via hasattr() guards,
but the test expectations unconditionally asserted tests_require would
be present in the output.

Use a runtime feature probe (_HAS_TESTS_REQUIRE) to conditionally
include tests_require in expected test data, so tests pass on both
old and new setuptools versions.

Fixes #20
…ncat

Move tests_require to a separate parametrize argument and check it
conditionally in the test body. This avoids W504 and E12x lint
violations from the list concatenation approach.
@toabctl toabctl merged commit d1bea9a into master Mar 10, 2026
10 checks passed
@toabctl toabctl deleted the fix/setuptools-70-tests-require branch March 10, 2026 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failing tests test_run_setup_py_from_dir

1 participant