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

Pytest fixtures are wrongly defined as unused #543

Open
gpkc opened this issue Dec 24, 2023 · 1 comment
Open

Pytest fixtures are wrongly defined as unused #543

gpkc opened this issue Dec 24, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@gpkc
Copy link

gpkc commented Dec 24, 2023

Describe the bug

Packages that are used just as pytest fixtures are wrongly set as unused.

To Reproduce

Steps to reproduce the behavior:

  1. Install pytest-freezer as an example
  2. Create a test that uses that fixture, e.g.
def test_frozen(freezer):
    freezer.move_to("2021-01-01T00:00:00")
  1. Verify that deptry will flag the package.

Expected behavior

The package should not be flagged.

Additional context

I'm not sure if there's a way to do that, or if it's too much outside of the scope of the package. But I'd say this is probably a big enough use case (supporting pytest) that maybe it should be taken into account.

@gpkc gpkc added the bug Something isn't working label Dec 24, 2023
@mkniewallner
Copy link
Collaborator

Development dependencies are not flagged as unused packages, and usually packages that are only meant to be used in dev/tests should be specified in development specific dependencies groups. I don't know about your setup, nor which package manger you use, but if possible, it would be recommended to declare pytest-freezer as a development package in your dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants