pytest-dev / pytest-dev/pytest

Dependencies between xunit-style setups and the other fixtures

Open
#5,949 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

https://github.com/pytest-dev/pytest/pull/4091 introduced a nice feature employed xunit-style setups and unittest definitions as internal fixtures.

But unfortunately, it looks like there is no way to make a strict order of fixture setup as It made in case of regular ones. Yes, sure, setup*/teardown* have
their own fixture names, but they are internal, for example:

_Class__pytest_setup_class
_UnitTestCase__pytest_class_setup

I couldn't rely on them since they are not documented and could be different from release to release.

The second problem that even if I drop xunit/unittest setups I can't forbid their usage by Pytest means.

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 by reading pull request 4091 and the issue's discussion of xunit-style setups, unittest definitions, and their internal fixtures. Trace how setup and teardown ordering is currently handled and identify the documented behavior that would need to support strict ordering or prevent these setups from being used. Done means the requested behavior is defined and covered by appropriate pytest tests.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.