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

Allow custom fixture names for fixtures #1444

Merged

Conversation

novas0x2a
Copy link
Contributor

When defining a fixture in the same module as where it is used, the
function argument shadows the fixture name, which a) annoys pylint and
b) can lead to bugs where you forget pull a fixture into a test method.

This allows one to define fixtures with a custom name override,
bypassing that problem.

I felt a little weird about thanking myself in the changelog.

@The-Compiler
Copy link
Member

LGTM but I'd rather let someone else do the merge as I don't know the fixture code 😉

Thanks!

@RonnyPfannschmidt
Copy link
Member

LGTM as well, but i'd like @hpk42 to be the one to merge this one

@nicoddemus
Copy link
Member

👍 from me as well, I just think it is missing some mention in the docs (inclusive providing the rationale).

@novas0x2a
Copy link
Contributor Author

Should I just add a new entry to the end of the fixture doc?

When defining a fixture in the same module as where it is used, the
function argument shadows the fixture name, which a) annoys pylint and
b) can lead to bugs where you forget to request a fixture into a test
method.

This allows one to define fixtures with a different name than the name
of the function, bypassing that problem.
@novas0x2a
Copy link
Contributor Author

Pushed a new version that updates the docstring (oops, forgot to do that originally). Hopefully this suffices for docs.

@nicoddemus
Copy link
Member

I guess so. Thanks!

@novas0x2a
Copy link
Contributor Author

anything i can do to make merging this easier?

@The-Compiler
Copy link
Member

I guess if nobody else steps up I'll just merge this later today and be prepared to take the blame if something goes wrong (though I can't see what would) 😆

RonnyPfannschmidt added a commit that referenced this pull request Mar 14, 2016
Allow custom fixture names for fixtures
@RonnyPfannschmidt RonnyPfannschmidt merged commit 0cacdef into pytest-dev:features Mar 14, 2016
@nicoddemus
Copy link
Member

👍

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

Successfully merging this pull request may close these issues.

4 participants