[pypy-commit] pypy py3tests: Revert changes to _pytest/ made by this branch
rlamy
pypy.commits at gmail.com
Tue Mar 20 17:51:56 EDT 2018
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3tests
Changeset: r94042:46d7ec4d97a8
Date: 2018-03-20 22:51 +0100
http://bitbucket.org/pypy/pypy/changeset/46d7ec4d97a8/
Log: Revert changes to _pytest/ made by this branch
diff --git a/_pytest/assertion/rewrite.py b/_pytest/assertion/rewrite.py
--- a/_pytest/assertion/rewrite.py
+++ b/_pytest/assertion/rewrite.py
@@ -265,10 +265,10 @@
if (not source.startswith(BOM_UTF8) and
cookie_re.match(source[0:end1]) is None and
cookie_re.match(source[end1 + 1:end2]) is None):
- # if hasattr(state, "_indecode"):
- # # encodings imported us again, so don't rewrite.
- # return None, None
- # state._indecode = True
+ if hasattr(state, "_indecode"):
+ # encodings imported us again, so don't rewrite.
+ return None, None
+ state._indecode = True
try:
try:
source.decode("ascii")
@@ -293,21 +293,10 @@
except SyntaxError:
# It's possible that this error is from some bug in the
# assertion rewriting, but I don't know of a fast way to tell.
- # state.trace("failed to compile: %r" % (fn,))
+ state.trace("failed to compile: %r" % (fn,))
return None, None
return stat, co
-
-def create_module(co):
- """Hack to create a module from a code object created by _rewrite_test()"""
- mod = imp.new_module(co.co_filename.split('/')[-1].split('.')[0])
- mod.__file__ = co.co_filename
- # mod.__cached__ = pyc
- mod.__loader__ = None
- exec(co, mod.__dict__)
- return mod
-
-
def _make_rewritten_pyc(state, source_stat, pyc, co):
"""Try to dump rewritten code to *pyc*."""
if sys.platform.startswith("win"):
More information about the pypy-commit
mailing list