Merge pull request #4890 from blueyed/dead

pytester: remove unused anypython fixture
This commit is contained in:
Bruno Oliveira 2019-03-06 14:35:23 -03:00 committed by GitHub
commit 936f725b81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 42 deletions

View File

@ -0,0 +1 @@
Remove internally unused ``anypython`` fixture from the pytester plugin.

View File

@ -4,7 +4,6 @@ from __future__ import division
from __future__ import print_function from __future__ import print_function
import codecs import codecs
import distutils.spawn
import gc import gc
import os import os
import platform 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 # used at least by pytest-xdist plugin