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

Closed
pytestbot opened this Issue May 5, 2014 · 3 comments

Comments

Projects
None yet
3 participants
@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 https://gist.github.com/public/e671a53b70fbb6fb6129

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.


@pytestbot

This comment has been minimized.

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 :)

@RonnyPfannschmidt

This comment has been minimized.

Member

RonnyPfannschmidt commented Apr 24, 2016

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

@RonnyPfannschmidt

This comment has been minimized.

Member

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

Merge pull request #1530 from RonnyPfannschmidt/fix-510
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

wiz
Updated py-test to 2.9.2.
2.9.2
=====

**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: https://github.com/pytest-dev/pytest/issue/1496
.. _#1524: https://github.com/pytest-dev/pytest/issue/1524

.. _@prusse-martin: https://github.com/prusse-martin
.. _@astraw38: https://github.com/astraw38

@pyup-bot pyup-bot referenced this issue Jun 9, 2016

Merged

Initial Update #33

@pyup-bot pyup-bot referenced this issue Jul 19, 2016

Merged

Initial Update #20

@pyup-bot pyup-bot referenced this issue Aug 4, 2016

Merged

Initial Update #43

@pyup-bot pyup-bot referenced this issue Sep 12, 2016

Merged

Initial Update #1

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