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

Add package property to request #12852

Open
apvd opened this issue Oct 4, 2024 · 1 comment
Open

Add package property to request #12852

apvd opened this issue Oct 4, 2024 · 1 comment

Comments

@apvd
Copy link

apvd commented Oct 4, 2024

What's the problem this feature will solve?

Fixtures can have function, class, and module specific behavior by inspecting request but not package specific behavior, even for package scoped fixtures.

Describe the solution you'd like

Add a package property to FeatureRequest, similar to the current module property, that returns the closest node of type Package.

Alternative Solutions

Current solution would be to have separate fixtures in each package, rather than one fixture with package-specific behavior.

@bluetech
Copy link
Member

Hi @apvd, can you describe your use case for getting the package?

I'd mention that packages are a bit different than the others in that packages can be nested, and thus there may be multiple package "scopes" active at the same time. So there a chance of some confusion, e.g.

root/
   __init__.py
   sub/
      __init__.py
      test_it.py

Say the test is in test_it.py and the fixture is in root. Using request.package in the fixture will return package sub, but maybe some users expect it to be root.

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

No branches or pull requests

2 participants