fix #510 by adding a describing skip marker on empty parameterize
This commit is contained in:
parent
436e13ac25
commit
d217b52508
|
@ -3,7 +3,8 @@
|
||||||
|
|
||||||
**Bug Fixes**
|
**Bug Fixes**
|
||||||
|
|
||||||
*
|
* fix `#510`_: skip tests where one parameterize dimension was empty
|
||||||
|
thanks Alex Stapleton for the Report and `@RonnyPfannschmidt`_ for the PR
|
||||||
|
|
||||||
* Fix win32 path issue when puttinging custom config file with absolute path
|
* Fix win32 path issue when puttinging custom config file with absolute path
|
||||||
in ``pytest.main("-c your_absolute_path")``.
|
in ``pytest.main("-c your_absolute_path")``.
|
||||||
|
|
|
@ -990,6 +990,13 @@ class Metafunc(FuncargnamesCompatAttr):
|
||||||
argvalues = [(val,) for val in argvalues]
|
argvalues = [(val,) for val in argvalues]
|
||||||
if not argvalues:
|
if not argvalues:
|
||||||
argvalues = [(_notexists,) * len(argnames)]
|
argvalues = [(_notexists,) * len(argnames)]
|
||||||
|
# we passed a empty list to parameterize, skip that test
|
||||||
|
#
|
||||||
|
newmark = pytest.mark.skip(
|
||||||
|
reason='argument listing for %r was empty' % argnames)
|
||||||
|
newmarks = newkeywords.setdefault(0, {})
|
||||||
|
newmarks[newmark.markname] = newmark
|
||||||
|
|
||||||
|
|
||||||
if scope is None:
|
if scope is None:
|
||||||
scope = "function"
|
scope = "function"
|
||||||
|
|
|
@ -109,6 +109,13 @@ class TestMetafunc:
|
||||||
metafunc.parametrize(("x","y"), [("abc", "def"),
|
metafunc.parametrize(("x","y"), [("abc", "def"),
|
||||||
("ghi", "jkl")], ids=["one"]))
|
("ghi", "jkl")], ids=["one"]))
|
||||||
|
|
||||||
|
@pytest.mark.issue510
|
||||||
|
def test_parametrize_empty_list(self):
|
||||||
|
def func( y): pass
|
||||||
|
metafunc = self.Metafunc(func)
|
||||||
|
metafunc.parametrize("y", [])
|
||||||
|
assert 'skip' in metafunc._calls[0].keywords
|
||||||
|
|
||||||
def test_parametrize_with_userobjects(self):
|
def test_parametrize_with_userobjects(self):
|
||||||
def func(x, y): pass
|
def func(x, y): pass
|
||||||
metafunc = self.Metafunc(func)
|
metafunc = self.Metafunc(func)
|
||||||
|
|
Loading…
Reference in New Issue