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

Multiple calls to parametrize result in empty value lists not skipping the test #510

pytestbot opened this issue May 5, 2014 · 3 comments


Copy link

@pytestbot pytestbot commented May 5, 2014

Originally reported by: Alex Stapleton (BitBucket: private, GitHub: private)

If you call parametrize on a test more than once for different arguments of the test it doesn't seem to combine the parameters correctly if some of them are empty. This results in tests that would normally get skipped because their parametisation is missing values receiving the internal _notset sentinel object for that fixture.

Examples here

The last example is the simplest reproduction of the problem.

This does not get skipped and fixP is _notset.

@pytest.mark.parametrize(["fixP"], [(1,)])
@pytest.mark.parametrize(["fixQ"], [])
def test_fixA_fixB_bad2(fixP, fixQ):
    print fixP, fixQ

but if you swap the order of the calls to parametrize...

@pytest.mark.parametrize(["fixQ"], [])
@pytest.mark.parametrize(["fixP"], [(1,)])
def test_fixA_fixB_bad2(fixP, fixQ):
    print fixP, fixQ

it skips as you would expect from reading the documentation.

I've reproduced this on 2.5.2 and on the current master 2.6 branch.

Copy link
Contributor Author

@pytestbot pytestbot commented Jul 23, 2014

Original comment by Alex Stapleton (BitBucket: private, GitHub: private):

Hey @flub thanks for the suggestion about working around this issue at EuroPython. Will give it a go :)

Copy link

@RonnyPfannschmidt RonnyPfannschmidt commented Apr 24, 2016

i just found a skip thats in place for this, but not being triggered

Copy link

@RonnyPfannschmidt RonnyPfannschmidt commented May 30, 2016

found the skip reason

callspec copying does not copy the trigger

nicoddemus added a commit that referenced this issue May 30, 2016
fix #510 by adding a describing skip marker on empty parameterize
jsonn pushed a commit to jsonn/pkgsrc that referenced this issue Jun 6, 2016

**Bug Fixes**

* fix `#510`_: skip tests where one parameterize dimension was empty
  thanks Alex Stapleton for the Report and `@RonnyPfannschmidt`_ for the PR

* Fix Xfail does not work with condition keyword argument.
  Thanks `@astraw38`_ for reporting the issue (`#1496`_) and `@tomviner`_
  for PR the (`#1524`_).

* Fix win32 path issue when puttinging custom config file with absolute path
  in ``pytest.main("-c your_absolute_path")``.

* Fix maximum recursion depth detection when raised error class is not aware
  of unicode/encoded bytes.
  Thanks `@prusse-martin`_ for the PR (`#1506`_).

* Fix ``pytest.mark.skip`` mark when used in strict mode.
  Thanks `@pquentin`_ for the PR and `@RonnyPfannschmidt`_ for
  showing how to fix the bug.

* Minor improvements and fixes to the documentation.
  Thanks `@omarkohl`_ for the PR.

* Fix ``--fixtures`` to show all fixture definitions as opposed to just
  one per fixture name.
  Thanks to `@hackebrot`_ for the PR.

.. _#510: pytest-dev/pytest#510
.. _#1506: pytest-dev/pytest#1506
.. _#1496:
.. _#1524:

.. _@prusse-martin:
.. _@astraw38:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants