1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/f4c3910cacf1/ Changeset: f4c3910cacf1 User: hpk42 Date: 2013-04-30 12:05:58 Summary: fix recursion within import hook and source.decode in particular Affected #: 2 files
diff -r 989df06f4c26be6e15cbe52760be670270a806b2 -r f4c3910cacf1ba5494814ab465eeba236af956db _pytest/assertion/rewrite.py --- a/_pytest/assertion/rewrite.py +++ b/_pytest/assertion/rewrite.py @@ -215,11 +215,17 @@ if (not source.startswith(BOM_UTF8) and (not cookie_re.match(source[0:end1]) or not cookie_re.match(source[end1:end2]))): + if hasattr(state, "_indecode"): + return None # encodings imported us again, we don't rewrite + state._indecode = True try: - source.decode("ascii") - except UnicodeDecodeError: - # Let it fail in real import. - return None + try: + source.decode("ascii") + except UnicodeDecodeError: + # Let it fail in real import. + return None + finally: + del state._indecode # On Python versions which are not 2.7 and less than or equal to 3.1, the # parser expects *nix newlines. if REWRITE_NEWLINES: diff -r 989df06f4c26be6e15cbe52760be670270a806b2 -r f4c3910cacf1ba5494814ab465eeba236af956db testing/test_assertion.py --- a/testing/test_assertion.py +++ b/testing/test_assertion.py @@ -320,3 +320,17 @@ result.stderr.fnmatch_lines([ "*WARNING*assert statements are not executed*", ]) + +def test_recursion_source_decode(testdir): + testdir.makepyfile(""" + def test_something(): + pass + """) + testdir.makeini(""" + [pytest] + python_files = *.py + """) + result = testdir.runpytest("--collectonly") + result.stdout.fnmatch_lines(""" + <Module*> + """) 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