1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/e507c61f1fc0/ Changeset: e507c61f1fc0 Branch: yield-test-run-inline User: RonnyPfannschmidt Date: 2015-02-11 00:06:55+00:00 Summary: small refactoring of yield test interpretation Affected #: 1 file
diff -r bd9f28f011eafe48ddf95b6a3e9dd260aa69c99f -r e507c61f1fc036a902cfcc3003d2d8b074273d06 _pytest/python.py --- a/_pytest/python.py +++ b/_pytest/python.py @@ -189,26 +189,35 @@ return request.config + +def _get_check_nameargs(obj, idx): + if not isinstance(obj, (list, tuple)): + obj = (obj,) + # explict naming + + if isinstance(obj[0], py.builtin._basestring): + name = '[%s]' % obj[0] + obj = obj[1:] + else: + name = '[%d]' % idx + call, args = obj[0], obj[1:] + if not callable(call): + pytest.fail('not a check\n' + 'name=%s call=%r args=%r' % (name, call, args)) + return name, call, args + + + @pytest.mark.trylast def pytest_pyfunc_interpret_result(pyfuncitem, result): if inspect.isgenerator(result): pyfuncitem.warn( code='G01', message='generator test, reporting is limited') - for check in result: + for idx, check in enumerate(result): # TODO(ronny): subtest support needed - if callable(check): - check() - elif not isinstance(check, tuple): - pytest.fail('%r is not a check' % (check,)) - elif callable(check[0]): - check[0](*check[1:]) - elif callable(check[1]): - check[1](*check[2:]) - else: - pytest.fail( - 'generator test check not callable \n%r' % (check,)) - + name, call, args = _get_check_nameargs(check, idx) + call(*args) @pytest.mark.trylast def pytest_pyfunc_call(pyfuncitem): 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