- add Brianna (@pfctdayelise ) to changelog and contributors
- fix some broken tests on py32/py33 (related to issue308 merge) - re-format docstrings -
This commit is contained in:
parent
bbc61c85ac
commit
8a0a18e9b3
1
AUTHORS
1
AUTHORS
|
@ -8,6 +8,7 @@ Benjamin Peterson
|
||||||
Floris Bruynooghe
|
Floris Bruynooghe
|
||||||
Jason R. Coombs
|
Jason R. Coombs
|
||||||
Samuele Pedroni
|
Samuele Pedroni
|
||||||
|
Brianna Laugher
|
||||||
Carl Friedrich Bolz
|
Carl Friedrich Bolz
|
||||||
Armin Rigo
|
Armin Rigo
|
||||||
Maho
|
Maho
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
Changes between 2.3.5 and 2.4.DEV
|
Changes between 2.3.5 and 2.4.DEV
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
|
||||||
|
- fix issue 308 - allow to mark/xfail/skip individual parameter sets
|
||||||
|
when parametrizing. Thanks Brianna Laugher.
|
||||||
|
|
||||||
- (experimental) allow fixture functions to be
|
- (experimental) allow fixture functions to be
|
||||||
implemented as context managers. Thanks Andreas Pelme,
|
implemented as context managers. Thanks Andreas Pelme,
|
||||||
Vladimir Keleshev.
|
Vladimir Keleshev.
|
||||||
|
|
|
@ -651,11 +651,12 @@ class Metafunc(FuncargnamesCompatAttr):
|
||||||
|
|
||||||
:arg argnames: an argument name or a list of argument names
|
:arg argnames: an argument name or a list of argument names
|
||||||
|
|
||||||
:arg argvalues: The list of argvalues determines how often a test is invoked
|
:arg argvalues: The list of argvalues determines how often a
|
||||||
with different argument values. If only one argname was specified argvalues
|
test is invoked with different argument values. If only one
|
||||||
is a list of simple values. If N argnames were specified, argvalues must
|
argname was specified argvalues is a list of simple values. If N
|
||||||
be a list of N-tuples, where each tuple-element specifies a value for its
|
argnames were specified, argvalues must be a list of N-tuples,
|
||||||
respective argname.
|
where each tuple-element specifies a value for its respective
|
||||||
|
argname.
|
||||||
|
|
||||||
:arg indirect: if True each argvalue corresponding to an argname will
|
:arg indirect: if True each argvalue corresponding to an argname will
|
||||||
be passed as request.param to its respective argname fixture
|
be passed as request.param to its respective argname fixture
|
||||||
|
@ -671,20 +672,20 @@ class Metafunc(FuncargnamesCompatAttr):
|
||||||
It will also override any fixture-function defined scope, allowing
|
It will also override any fixture-function defined scope, allowing
|
||||||
to set a dynamic scope using test context or configuration.
|
to set a dynamic scope using test context or configuration.
|
||||||
"""
|
"""
|
||||||
# remove any marks applied to individual tests instances
|
|
||||||
# these marks will be applied in Function init
|
# individual parametrized argument sets can be wrapped in a
|
||||||
|
# marker in which case we unwrap the values and apply the mark
|
||||||
|
# at Function init
|
||||||
newkeywords = {}
|
newkeywords = {}
|
||||||
strippedargvalues = []
|
unwrapped_argvalues = []
|
||||||
for i, argval in enumerate(argvalues):
|
for i, argval in enumerate(argvalues):
|
||||||
if isinstance(argval, MarkDecorator):
|
if isinstance(argval, MarkDecorator):
|
||||||
# convert into a mark without the test content mixed in
|
newmark = MarkDecorator(argval.markname,
|
||||||
newmark = MarkDecorator(argval.markname, argval.args[:-1], argval.kwargs)
|
argval.args[:-1], argval.kwargs)
|
||||||
newkeywords[i] = {newmark.markname: newmark}
|
newkeywords[i] = {newmark.markname: newmark}
|
||||||
strippedargvalues.append(argval.args[-1])
|
argval = argval.args[-1]
|
||||||
else:
|
unwrapped_argvalues.append(argval)
|
||||||
newkeywords[i] = {}
|
argvalues = unwrapped_argvalues
|
||||||
strippedargvalues.append(argval)
|
|
||||||
argvalues = strippedargvalues
|
|
||||||
|
|
||||||
if not isinstance(argnames, (tuple, list)):
|
if not isinstance(argnames, (tuple, list)):
|
||||||
argnames = (argnames,)
|
argnames = (argnames,)
|
||||||
|
@ -710,7 +711,7 @@ class Metafunc(FuncargnamesCompatAttr):
|
||||||
assert len(valset) == len(argnames)
|
assert len(valset) == len(argnames)
|
||||||
newcallspec = callspec.copy(self)
|
newcallspec = callspec.copy(self)
|
||||||
newcallspec.setmulti(valtype, argnames, valset, ids[i],
|
newcallspec.setmulti(valtype, argnames, valset, ids[i],
|
||||||
newkeywords[i], scopenum)
|
newkeywords.get(i, {}), scopenum)
|
||||||
newcalls.append(newcallspec)
|
newcalls.append(newcallspec)
|
||||||
self._calls = newcalls
|
self._calls = newcalls
|
||||||
|
|
||||||
|
|
|
@ -578,8 +578,8 @@ class TestMetafuncFunctional:
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.issue308
|
|
||||||
class TestMarkersWithParametrization:
|
class TestMarkersWithParametrization:
|
||||||
|
pytestmark = pytest.mark.issue308
|
||||||
def test_simple_mark(self, testdir):
|
def test_simple_mark(self, testdir):
|
||||||
s = """
|
s = """
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -680,7 +680,7 @@ class TestMarkersWithParametrization:
|
||||||
|
|
||||||
@pytest.mark.parametrize(("n", "expected"), [
|
@pytest.mark.parametrize(("n", "expected"), [
|
||||||
(1, 2),
|
(1, 2),
|
||||||
pytest.mark.xfail("sys.version > 0")((1, 3)),
|
pytest.mark.xfail("True")((1, 3)),
|
||||||
(2, 3),
|
(2, 3),
|
||||||
])
|
])
|
||||||
def test_increment(n, expected):
|
def test_increment(n, expected):
|
||||||
|
@ -712,7 +712,7 @@ class TestMarkersWithParametrization:
|
||||||
|
|
||||||
@pytest.mark.parametrize(("n", "expected"), [
|
@pytest.mark.parametrize(("n", "expected"), [
|
||||||
(1, 2),
|
(1, 2),
|
||||||
pytest.mark.xfail("sys.version > 0", reason="some bug")((1, 3)),
|
pytest.mark.xfail("True", reason="some bug")((1, 3)),
|
||||||
(2, 3),
|
(2, 3),
|
||||||
])
|
])
|
||||||
def test_increment(n, expected):
|
def test_increment(n, expected):
|
||||||
|
|
2
tox.ini
2
tox.ini
|
@ -31,7 +31,7 @@ setenv=
|
||||||
PYTHONDONTWRITEBYTECODE=1
|
PYTHONDONTWRITEBYTECODE=1
|
||||||
commands=
|
commands=
|
||||||
py.test -n3 -rfsxX \
|
py.test -n3 -rfsxX \
|
||||||
--junitxml={envlogdir}/junit-{envname}.xml []
|
--junitxml={envlogdir}/junit-{envname}.xml {posargs:testing}
|
||||||
|
|
||||||
[testenv:trial]
|
[testenv:trial]
|
||||||
changedir=.
|
changedir=.
|
||||||
|
|
Loading…
Reference in New Issue