pytest-dev / pytest-dev/pytest

scoped tmp_path_factory fixtures

Open
#5,219 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I think that there should be tmp_path_factorys and other similar fixtures with different scopes. I initially started working on this as a PR for pytest-datadir but the implementation of the scoped factories should really be upstream here. The implementation is simple:

https://github.com/gabrielcnr/pytest-datadir/pull/27/files#diff-fb0ca03425023403a38456a8f44597bfR99

The question is whether this is the way to provide them, i.e. the pattern <scope>_<fixture_name> e.g. class_tmp_path_factory.

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 with the implementation linked from pytest-datadir PR #27, especially the referenced diff, then review pytest's existing tmp_path_factory fixture API and scope conventions. Done means pytest provides equivalent fixtures for the required scopes with an agreed naming pattern such as _<fixture_name>.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.