pytest-dev / pytest-dev/pytest

Add `package` property to `request`

Open
#12,852 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic: fixtures type: proposal
Dominant language
Python
Stars
14.5k
Forks
3.4k
Avg merge
2d 9h
Merged PRs (30d)
35

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at FeatureRequest and inspect the existing module property, then trace how it finds the closest Package node. Add the analogous package behavior and verify it with the relevant fixture/request tests; done means package-scoped fixtures can inspect request.package for package-specific behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.