- 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:
holger krekel 2013-05-22 15:24:58 +02:00
parent bbc61c85ac
commit 8a0a18e9b3
5 changed files with 25 additions and 20 deletions

View File

@ -8,6 +8,7 @@ Benjamin Peterson
Floris Bruynooghe
Jason R. Coombs
Samuele Pedroni
Brianna Laugher
Carl Friedrich Bolz
Armin Rigo
Maho

View File

@ -1,6 +1,9 @@
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
implemented as context managers. Thanks Andreas Pelme,
Vladimir Keleshev.

View File

@ -651,11 +651,12 @@ class Metafunc(FuncargnamesCompatAttr):
:arg argnames: an argument name or a list of argument names
:arg argvalues: The list of argvalues determines how often a test is invoked
with different argument values. If only one argname was specified argvalues
is a list of simple values. If N argnames were specified, argvalues must
be a list of N-tuples, where each tuple-element specifies a value for its
respective argname.
:arg argvalues: The list of argvalues determines how often a
test is invoked with different argument values. If only one
argname was specified argvalues is a list of simple values. If N
argnames were specified, argvalues must be a list of N-tuples,
where each tuple-element specifies a value for its respective
argname.
:arg indirect: if True each argvalue corresponding to an argname will
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
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 = {}
strippedargvalues = []
unwrapped_argvalues = []
for i, argval in enumerate(argvalues):
if isinstance(argval, MarkDecorator):
# convert into a mark without the test content mixed in
newmark = MarkDecorator(argval.markname, argval.args[:-1], argval.kwargs)
newmark = MarkDecorator(argval.markname,
argval.args[:-1], argval.kwargs)
newkeywords[i] = {newmark.markname: newmark}
strippedargvalues.append(argval.args[-1])
else:
newkeywords[i] = {}
strippedargvalues.append(argval)
argvalues = strippedargvalues
argval = argval.args[-1]
unwrapped_argvalues.append(argval)
argvalues = unwrapped_argvalues
if not isinstance(argnames, (tuple, list)):
argnames = (argnames,)
@ -710,7 +711,7 @@ class Metafunc(FuncargnamesCompatAttr):
assert len(valset) == len(argnames)
newcallspec = callspec.copy(self)
newcallspec.setmulti(valtype, argnames, valset, ids[i],
newkeywords[i], scopenum)
newkeywords.get(i, {}), scopenum)
newcalls.append(newcallspec)
self._calls = newcalls

View File

@ -578,8 +578,8 @@ class TestMetafuncFunctional:
])
@pytest.mark.issue308
class TestMarkersWithParametrization:
pytestmark = pytest.mark.issue308
def test_simple_mark(self, testdir):
s = """
import pytest
@ -680,7 +680,7 @@ class TestMarkersWithParametrization:
@pytest.mark.parametrize(("n", "expected"), [
(1, 2),
pytest.mark.xfail("sys.version > 0")((1, 3)),
pytest.mark.xfail("True")((1, 3)),
(2, 3),
])
def test_increment(n, expected):
@ -712,7 +712,7 @@ class TestMarkersWithParametrization:
@pytest.mark.parametrize(("n", "expected"), [
(1, 2),
pytest.mark.xfail("sys.version > 0", reason="some bug")((1, 3)),
pytest.mark.xfail("True", reason="some bug")((1, 3)),
(2, 3),
])
def test_increment(n, expected):

View File

@ -31,7 +31,7 @@ setenv=
PYTHONDONTWRITEBYTECODE=1
commands=
py.test -n3 -rfsxX \
--junitxml={envlogdir}/junit-{envname}.xml []
--junitxml={envlogdir}/junit-{envname}.xml {posargs:testing}
[testenv:trial]
changedir=.