Skip to content

Commit 58bfc77

Browse files
committed
Use shutil.which to avoid distutils+imp warning
1 parent 97f0a20 commit 58bfc77

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

doc/en/example/multipython.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
module containing a parametrized tests testing cross-python
33
serialization via the pickle module.
44
"""
5-
import distutils.spawn
5+
import shutil
66
import subprocess
77
import textwrap
88

@@ -24,7 +24,7 @@ def python2(request, python1):
2424

2525
class Python:
2626
def __init__(self, version, picklefile):
27-
self.pythonpath = distutils.spawn.find_executable(version)
27+
self.pythonpath = shutil.which(version)
2828
if not self.pythonpath:
2929
pytest.skip("{!r} not found".format(version))
3030
self.picklefile = picklefile

doc/en/example/parametrize.rst

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -435,15 +435,9 @@ Running it results in some skips if we don't have all the python interpreters in
435435
436436
. $ pytest -rs -q multipython.py
437437
ssssssssssss......sss...... [100%]
438-
============================= warnings summary =============================
439-
$PYTHON_PREFIX/lib/python3.6/distutils/__init__.py:1
440-
$PYTHON_PREFIX/lib/python3.6/distutils/__init__.py:1: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
441-
import imp
442-
443-
-- Docs: https://docs.pytest.org/en/latest/warnings.html
444438
========================= short test summary info ==========================
445439
SKIPPED [15] $REGENDOC_TMPDIR/CWD/multipython.py:30: 'python3.5' not found
446-
12 passed, 15 skipped, 1 warnings in 0.12 seconds
440+
12 passed, 15 skipped in 0.12 seconds
447441
448442
Indirect parametrization of optional implementations/imports
449443
--------------------------------------------------------------------

0 commit comments

Comments
 (0)