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

Improve error message when using @pytest.fixture twice #11670

Merged

Conversation

The-Compiler
Copy link
Member

While obvious in hindsight, this error message confused me. I thought my fixture function was used in a test function twice, since the wording is ambiguous.

Also, the error does not tell me which function is the culprit.

Finally, this adds a test, which wasn't done in
cfd16d0 where this was originally implemented.

While obvious in hindsight, this error message confused me. I thought my fixture
function was used in a test function twice, since the wording is ambiguous.

Also, the error does not tell me *which* function is the culprit.

Finally, this adds a test, which wasn't done in
cfd16d0 where this was originally implemented.
@The-Compiler The-Compiler added the needs backport applied to PRs, indicates that it should be ported to the current bug-fix branch label Dec 5, 2023
@bluetech
Copy link
Member

bluetech commented Feb 9, 2024

@The-Compiler is this ready to merge or still needs work?

@The-Compiler
Copy link
Member Author

Thanks for the reminder, completely forgot about this! Good to merge I'd say.

@The-Compiler The-Compiler merged commit 7690a0d into pytest-dev:main Feb 9, 2024
22 checks passed
flying-sheep pushed a commit to flying-sheep/pytest that referenced this pull request Apr 9, 2024
)

* Improve error message when using @pytest.fixture twice

While obvious in hindsight, this error message confused me. I thought my fixture
function was used in a test function twice, since the wording is ambiguous.

Also, the error does not tell me *which* function is the culprit.

Finally, this adds a test, which wasn't done in
cfd16d0 where this was originally implemented.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs backport applied to PRs, indicates that it should be ported to the current bug-fix branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants