1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/6865f468f152/ Changeset: 6865f468f152 User: hpk42 Date: 2013-05-22 15:24:58 Summary: - add Brianna (@pfctdayelise ) to changelog and contributors - fix some broken tests on py32/py33 (related to issue308 merge) - re-format docstrings - Affected #: 5 files
diff -r fff62647d8622e95f5f0e28f1e4a25aeeb4b0a8f -r 6865f468f15242e1a399fd20e9bc9e5ad44cb02d AUTHORS --- a/AUTHORS +++ b/AUTHORS @@ -8,6 +8,7 @@ Floris Bruynooghe Jason R. Coombs Samuele Pedroni +Brianna Laugher Carl Friedrich Bolz Armin Rigo Maho diff -r fff62647d8622e95f5f0e28f1e4a25aeeb4b0a8f -r 6865f468f15242e1a399fd20e9bc9e5ad44cb02d CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -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. diff -r fff62647d8622e95f5f0e28f1e4a25aeeb4b0a8f -r 6865f468f15242e1a399fd20e9bc9e5ad44cb02d _pytest/python.py --- a/_pytest/python.py +++ b/_pytest/python.py @@ -651,11 +651,12 @@ :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 @@ 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 @@ 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 diff -r fff62647d8622e95f5f0e28f1e4a25aeeb4b0a8f -r 6865f468f15242e1a399fd20e9bc9e5ad44cb02d testing/python/metafunc.py --- a/testing/python/metafunc.py +++ b/testing/python/metafunc.py @@ -578,8 +578,8 @@ ]) -@pytest.mark.issue308 class TestMarkersWithParametrization: + pytestmark = pytest.mark.issue308 def test_simple_mark(self, testdir): s = """ import pytest @@ -680,7 +680,7 @@ @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 @@ @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): diff -r fff62647d8622e95f5f0e28f1e4a25aeeb4b0a8f -r 6865f468f15242e1a399fd20e9bc9e5ad44cb02d tox.ini --- a/tox.ini +++ b/tox.ini @@ -31,7 +31,7 @@ PYTHONDONTWRITEBYTECODE=1 commands= py.test -n3 -rfsxX \ - --junitxml={envlogdir}/junit-{envname}.xml [] + --junitxml={envlogdir}/junit-{envname}.xml {posargs:testing} [testenv:trial] changedir=. Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. _______________________________________________ pytest-commit mailing list pytest-commit@python.org http://mail.python.org/mailman/listinfo/pytest-commit