Proposal: Parametrize with fixtures #1660

Merged
merged 10 commits into from Jun 25, 2016

Conversation

Projects
None yet
6 participants
@hackebrot
Member

hackebrot commented Jun 25, 2016

Please see the Problem section of the added document.

@hpk42 and myself worked on this proposal in the course of the pytest-dev sprint.

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Jun 25, 2016

Coverage Status

Coverage remained the same at 92.389% when pulling 5860c60 on hackebrot:parametrize-with-fixtures into f2bb3df on pytest-dev:features.

coveralls commented Jun 25, 2016

Coverage Status

Coverage remained the same at 92.389% when pulling 5860c60 on hackebrot:parametrize-with-fixtures into f2bb3df on pytest-dev:features.

@The-Compiler

This comment has been minimized.

Show comment
Hide comment
@The-Compiler

The-Compiler Jun 25, 2016

Member

I think stuff like that should be in a separate subfolder, like proposals or so?

Member

The-Compiler commented Jun 25, 2016

I think stuff like that should be in a separate subfolder, like proposals or so?

@hackebrot

This comment has been minimized.

Show comment
Hide comment
Member

hackebrot commented Jun 25, 2016

@The-Compiler done. 👍

+* This is very inconvenient if you wish to extend an existing test suite by
+ certain parameters for fixtures that are already used by tests
+
+pytest version 3.0 and higher reports an error if you try to run above code::

This comment has been minimized.

@hpk42

hpk42 Jun 25, 2016

Contributor

just talk about pytest-3.0, not "higher"

@hpk42

hpk42 Jun 25, 2016

Contributor

just talk about pytest-3.0, not "higher"

@hackebrot

This comment has been minimized.

Show comment
Hide comment
@hackebrot

hackebrot Jun 25, 2016

Member

I've added a new entry to the changelog. If you could please thumb this? @hpk42 @The-Compiler 🙇

Member

hackebrot commented Jun 25, 2016

I've added a new entry to the changelog. If you could please thumb this? @hpk42 @The-Compiler 🙇

@coveralls

This comment has been minimized.

Show comment
Hide comment
@coveralls

coveralls Jun 25, 2016

Coverage Status

Coverage remained the same at 92.389% when pulling 1b6bc4d on hackebrot:parametrize-with-fixtures into f2bb3df on pytest-dev:features.

coveralls commented Jun 25, 2016

Coverage Status

Coverage remained the same at 92.389% when pulling 1b6bc4d on hackebrot:parametrize-with-fixtures into f2bb3df on pytest-dev:features.

@The-Compiler The-Compiler merged commit 35cd12e into pytest-dev:features Jun 25, 2016

0 of 2 checks passed

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
+Alternative approach
+--------------------
+
+A new helper function named ``fixture_request`` tells pytest to yield all

This comment has been minimized.

@nicoddemus

nicoddemus Jun 25, 2016

Member

@hackebrot after discussing in person with @hpk42, he convinced me the first approach beats this one. 😁

@nicoddemus

nicoddemus Jun 25, 2016

Member

@hackebrot after discussing in person with @hpk42, he convinced me the first approach beats this one. 😁

This comment has been minimized.

@hackebrot

hackebrot Jul 4, 2016

Member

@nicoddemus can you please comment here, what made you change your mind? 😄 (I am aware it's been a while already 😁 )

@hackebrot

hackebrot Jul 4, 2016

Member

@nicoddemus can you please comment here, what made you change your mind? 😄 (I am aware it's been a while already 😁 )

This comment has been minimized.

@nicoddemus

nicoddemus Jul 4, 2016

Member

I will try to remember then, but as you said it has been sometime already. 😁

@nicoddemus

nicoddemus Jul 4, 2016

Member

I will try to remember then, but as you said it has been sometime already. 😁

This comment has been minimized.

@hackebrot

hackebrot Jul 4, 2016

Member

Right, let me help you remember. Next beer is on me. 🍻

@hackebrot

hackebrot Jul 4, 2016

Member

Right, let me help you remember. Next beer is on me. 🍻

+
+.. code-block:: python
+
+ pytest.define_combined_fixture(

This comment has been minimized.

@fschulze

fschulze Jul 4, 2016

Contributor

If possible something like this would be more pythonic:

context = combined_fixture('default_context', 'extra_context')
@fschulze

fschulze Jul 4, 2016

Contributor

If possible something like this would be more pythonic:

context = combined_fixture('default_context', 'extra_context')

This comment has been minimized.

@hackebrot

hackebrot Jul 4, 2016

Member

This will raise a flake8 error as it an unused variable.

More importantly @hpk42 and myself feel like the keyword arguments make this helper more verbose and comprehensible.

@hackebrot

hackebrot Jul 4, 2016

Member

This will raise a flake8 error as it an unused variable.

More importantly @hpk42 and myself feel like the keyword arguments make this helper more verbose and comprehensible.

@hackebrot hackebrot deleted the hackebrot:parametrize-with-fixtures branch Jul 4, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment