-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
--fixtures-per-test
: Exclude parametrizing pseudo fixtures?
#11295
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
Comments
You think that
is clearer to the user? I am a new user (and a new developer) and I certainly find that clearer. The expectation I have for a fixture is that
If I see a fixture without a docstring, I'd assume I had created it somewhere. Which I would have. But not with the For me, it would be clearer if either
|
Yeah, IMHO those pseudo-fixtures just shouldn't show up there at all. |
I'm eager to start contributing. But am still a novice programmer. |
For a smaller change like this, an issue like we have here is a good place for this discussion to take place. Given that there hasn't been any push-back, I'd suggest you go ahead with a pull request! I'm not too familiar with the fixture code myself, but based on gut feeling, this sounds like a good first issue to tackle. Happy to help if you get stock somewhere! |
Amazing. =)
|
It has been over a week since I last commented on this issue so I thought I would share an update as I've made no Pull Request either:
I first mention the idea of doing a case study in I want to encourage beginners to contribute by making refactoring pull requests:
|
Addresses issue pytest-dev#11295 by excluding from the --fixtures-per-test output any 'pseudo fixture' that results from directly parametrizating a test with ``@pytest.mark.parametrize``. The justification for removing these fixtures from the report is that a) They are unintuitive. Their appearance in the fixtures-per-test report confuses new users because the fixtures created via ``@pytest.mark.parametrize`` do not confrom to the expectations established in the documentation; namely, that fixtures are - richly reusable - provide setup/teardown features - created via the ``@pytest.fixture` decorator b) They are an internal implementation detail. It is not the explicit goal of the direct parametrization mark to create a fixture; instead, pytest's internals leverages the fixture system to achieve the explicit goal: a succinct batch execution syntax. Consequently, exposing the fixtures that implement the batch execution behaviour reveal more about pytest's internals than they do about the user's own design choices and test dependencies.
Addresses issue pytest-dev#11295 by excluding from the --fixtures-per-test output any 'pseudo fixture' that results from directly parametrizating a test with ``@pytest.mark.parametrize``. The justification for removing these fixtures from the report is that a) They are unintuitive. Their appearance in the fixtures-per-test report confuses new users because the fixtures created via ``@pytest.mark.parametrize`` do not confrom to the expectations established in the documentation; namely, that fixtures are - richly reusable - provide setup/teardown features - created via the ``@pytest.fixture` decorator b) They are an internal implementation detail. It is not the explicit goal of the direct parametrization mark to create a fixture; instead, pytest's internals leverages the fixture system to achieve the explicit goal: a succinct batch execution syntax. Consequently, exposing the fixtures that implement the batch execution behaviour reveal more about pytest's internals than they do about the user's own design choices and test dependencies.
With something like:
running
pytest --fixtures-per-test
results in:IMHO, the output for
x
should be excluded here - while it is technically a (pseudo) fixture internally, showing it like that is rather confusing for users. It doesn't make sense to show it as a fixture without a docstring which is "defined" here:pytest/src/_pytest/fixtures.py
Lines 351 to 352 in d9bf9db
The text was updated successfully, but these errors were encountered: