From c86d2daf81e084981f62e76728df0198fbda4261 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 28 Feb 2019 12:14:31 +0100 Subject: [PATCH] pytester: remove unused anypython fixture This became unused after ab9f6a75 (in 2009). --- changelog/4890.trivial.rst | 1 + src/_pytest/pytester.py | 42 -------------------------------------- 2 files changed, 1 insertion(+), 42 deletions(-) create mode 100644 changelog/4890.trivial.rst diff --git a/changelog/4890.trivial.rst b/changelog/4890.trivial.rst new file mode 100644 index 000000000..a3a08bc11 --- /dev/null +++ b/changelog/4890.trivial.rst @@ -0,0 +1 @@ +Remove internally unused ``anypython`` fixture from the pytester plugin. diff --git a/src/_pytest/pytester.py b/src/_pytest/pytester.py index 4aab1a3eb..d667452d1 100644 --- a/src/_pytest/pytester.py +++ b/src/_pytest/pytester.py @@ -4,7 +4,6 @@ from __future__ import division from __future__ import print_function import codecs -import distutils.spawn import gc import os import platform @@ -151,47 +150,6 @@ winpymap = { } -def getexecutable(name, cache={}): - try: - return cache[name] - except KeyError: - executable = distutils.spawn.find_executable(name) - if executable: - import subprocess - - popen = subprocess.Popen( - [str(executable), "--version"], - universal_newlines=True, - stderr=subprocess.PIPE, - ) - out, err = popen.communicate() - if name == "jython": - if not err or "2.5" not in err: - executable = None - if "2.5.2" in err: - executable = None # http://bugs.jython.org/issue1790 - elif popen.returncode != 0: - # handle pyenv's 127 - executable = None - cache[name] = executable - return executable - - -@pytest.fixture(params=["python2.7", "python3.4", "pypy", "pypy3"]) -def anypython(request): - name = request.param - executable = getexecutable(name) - if executable is None: - if sys.platform == "win32": - executable = winpymap.get(name, None) - if executable: - executable = py.path.local(executable) - if executable.check(): - return executable - pytest.skip("no suitable %s found" % (name,)) - return executable - - # used at least by pytest-xdist plugin