diff --git a/_pytest/main.py b/_pytest/main.py index 4bddf1e2d..f05fa74b0 100644 --- a/_pytest/main.py +++ b/_pytest/main.py @@ -363,24 +363,6 @@ class Node(object): def teardown(self): pass - def _memoizedcall(self, attrname, function): - exattrname = "_ex_" + attrname - failure = getattr(self, exattrname, None) - if failure is not None: - py.builtin._reraise(failure[0], failure[1], failure[2]) - if hasattr(self, attrname): - return getattr(self, attrname) - try: - res = function() - except py.builtin._sysex: - raise - except: - failure = sys.exc_info() - setattr(self, exattrname, failure) - raise - setattr(self, attrname, res) - return res - def listchain(self): """ return list of all parent collectors up to self, starting from root of collection tree. """ diff --git a/_pytest/pytester.py b/_pytest/pytester.py index 674adca94..2c558183b 100644 --- a/_pytest/pytester.py +++ b/_pytest/pytester.py @@ -22,6 +22,11 @@ from _pytest.main import Session, EXIT_OK from _pytest.assertion.rewrite import AssertionRewritingHook +PYTEST_FULLPATH = os.path.abspath( + pytest.__file__.rstrip("oc") + ).replace("$py.class", ".py") + + def pytest_addoption(parser): # group = parser.getgroup("pytester", "pytester (self-tests) options") parser.addoption('--lsof', @@ -35,14 +40,6 @@ def pytest_addoption(parser): def pytest_configure(config): - # This might be called multiple times. Only take the first. - global _pytest_fullpath - try: - _pytest_fullpath - except NameError: - _pytest_fullpath = os.path.abspath(pytest.__file__.rstrip("oc")) - _pytest_fullpath = _pytest_fullpath.replace("$py.class", ".py") - if config.getvalue("lsof"): checker = LsofFdLeakChecker() if checker.matching_platform(): @@ -971,7 +968,7 @@ class Testdir: def _getpytestargs(self): # we cannot use "(sys.executable,script)" # because on windows the script is e.g. a pytest.exe - return (sys.executable, _pytest_fullpath,) # noqa + return (sys.executable, PYTEST_FULLPATH) # noqa def runpython(self, script): """Run a python script using sys.executable as interpreter.