1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/0d595ac74709/ Changeset: 0d595ac74709 User: hpk42 Date: 2014-01-27 12:53:44 Summary: simplify loop which turns direct funcarg parametrization to indirect Affected #: 2 files
diff -r b1b6c261d9b60d168ab2930a24fb3b24a884790e -r 0d595ac74709b416ff9ff7c52bed0f8de6bb6a9b _pytest/python.py --- a/_pytest/python.py +++ b/_pytest/python.py @@ -372,22 +372,22 @@ # collect funcargs of all callspecs into a list of values arg2params = {} arg2scope = {} - arg2fixturedefs = metafunc._arg2fixturedefs - for param_index, callspec in enumerate(metafunc._calls): + for callspec in metafunc._calls: for argname, argvalue in callspec.funcargs.items(): - arg2params.setdefault(argname, []).append(argvalue) + assert argname not in callspec.params + callspec.params[argname] = argvalue + arg2params_list = arg2params.setdefault(argname, []) + callspec.indices[argname] = len(arg2params_list) + arg2params_list.append(argvalue) if argname not in arg2scope: - scopenum = callspec._arg2scopenum.get(argname, scopenum_function) + scopenum = callspec._arg2scopenum.get(argname, + scopenum_function) arg2scope[argname] = scopes[scopenum] - callspec.indices[argname] = param_index - - for argname in callspec.funcargs: - assert argname not in callspec.params - callspec.params.update(callspec.funcargs) callspec.funcargs.clear() # register artificial FixtureDef's so that later at test execution # time we can rely on a proper FixtureDef to exist for fixture setup. + arg2fixturedefs = metafunc._arg2fixturedefs for argname, valuelist in arg2params.items(): # if we have a scope that is higher than function we need # to make sure we only ever create an according fixturedef on diff -r b1b6c261d9b60d168ab2930a24fb3b24a884790e -r 0d595ac74709b416ff9ff7c52bed0f8de6bb6a9b testing/python/fixture.py --- a/testing/python/fixture.py +++ b/testing/python/fixture.py @@ -1391,6 +1391,7 @@ reprec = testdir.inline_run("-s") reprec.assertoutcome(passed=2) + class TestFixtureMarker: def test_parametrize(self, testdir): testdir.makepyfile(""" 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 https://mail.python.org/mailman/listinfo/pytest-commit