Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move testing extras to a requirements_test.txt file #647

Conversation

mbyrnepr2
Copy link

@mbyrnepr2 mbyrnepr2 commented Jun 3, 2024

Move the testing extras from the setup.py to their own requirements_test.txt file.

Please let me know if I'm missing some details; I've put this together rather quickly.

The rationale here is that the extras list was showing up in a poetry.lock file for a project at my company. This was because pytest-cov was part of the dev-dependencies in a pyproject.toml file.
Our vulnerability scanning tool is designed to skip development dependencies. However, it doesn't skip a development dependency if it appears in the extras list in the poetry.lock file. Edit: the previous line appears to be inaccurate - it is skipped if there are only dev dependencies in pyproject.toml.

This is not a problem with pytest-cov per-se but perhaps the change is acceptable in any case and helps others potentially. Maybe this PR makes sense from the perspective that the test extras would never be used by downstream users, but otherwise please feel free to close it😅

Thanks for your time!

@mbyrnepr2 mbyrnepr2 force-pushed the testing_extras_to_requirements_file branch from bfe9ee0 to 8f6a984 Compare June 3, 2024 13:01
@mbyrnepr2 mbyrnepr2 force-pushed the testing_extras_to_requirements_file branch from 8f6a984 to b8719d5 Compare June 3, 2024 13:03
@ionelmc
Copy link
Member

ionelmc commented Aug 26, 2024

@blueyed added those extras, not sure if he needs them.

Regardless, I suspect this change will trip up linux packages for pytest-cov that use those extras for testing.

Why does poetry use that extra?

@mbyrnepr2
Copy link
Author

@blueyed added those extras, not sure if he needs them.

Regardless, I suspect this change will trip up linux packages for pytest-cov that use those extras for testing.

Why does poetry use that extra?

Fair point - and I'm not convinced my approach improves the situation.
It looks like uv.lock and pdm.lock do not contain that extras data that poetry.lock does; but I guess that's a separate matter.

Thanks for looking into it @ionelmc; I appreciate it but there's probably nothing needed here; the pattern looks common enough anyway: https://discuss.python.org/t/is-it-preferable-to-add-test-dependensies-as-an-extra-require-instead-of-tox-ini/4984

@mbyrnepr2 mbyrnepr2 closed this Aug 28, 2024
@mbyrnepr2 mbyrnepr2 deleted the testing_extras_to_requirements_file branch August 28, 2024 09:21
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.

2 participants