Use exec directly

This commit is contained in:
Anthony Sottile
2019-05-06 23:07:39 -07:00
parent 6d259c400e
commit d1a48ad68f
9 changed files with 10 additions and 16 deletions

View File

@@ -13,7 +13,6 @@ from weakref import ref
import attr
import pluggy
import py
import six
from six import text_type
import _pytest
@@ -138,7 +137,7 @@ class Frame(object):
"""
f_locals = self.f_locals.copy()
f_locals.update(vars)
six.exec_(code, self.f_globals, f_locals)
exec(code, self.f_globals, f_locals)
def repr(self, object):
""" return a 'safe' (non-recursive, one-line) string repr for 'object'

View File

@@ -296,7 +296,7 @@ class AssertionRewritingHook(object):
mod.__loader__ = self
# Normally, this attribute is 3.4+
mod.__spec__ = spec_from_file_location(name, co.co_filename, loader=self)
six.exec_(co, mod.__dict__)
exec(co, mod.__dict__)
except: # noqa
if name in sys.modules:
del sys.modules[name]

View File

@@ -7,7 +7,6 @@ import warnings
from decimal import Decimal
from numbers import Number
import six
from more_itertools.more import always_iterable
from six.moves import filterfalse
from six.moves import zip
@@ -702,7 +701,7 @@ def raises(expected_exception, *args, **kwargs):
# print "raises frame scope: %r" % frame.f_locals
try:
code = _pytest._code.Source(code).compile(_genframe=frame)
six.exec_(code, frame.f_globals, loc)
exec(code, frame.f_globals, loc)
# XXX didn't mean f_globals == f_locals something special?
# this is destroyed here ...
except expected_exception:

View File

@@ -102,7 +102,7 @@ def warns(expected_warning, *args, **kwargs):
with WarningsChecker(expected_warning):
code = _pytest._code.Source(code).compile()
six.exec_(code, frame.f_globals, loc)
exec(code, frame.f_globals, loc)
else:
func = args[0]
with WarningsChecker(expected_warning):