Skip to content

Commit 15aad15

Browse files
authored
Replace distutils.spawn.find_executable with shutil.which (#47)
The package distutils is deprecated and causes DeprecationWarnings. Replaced its usage with shutil.which.
1 parent f7e2e60 commit 15aad15

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pytest_services/gui.py.orig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import socket
77
import shlex
88
import subprocess32
99

10-
from distutils.spawn import find_executable
10+
from shutil import which
1111
import pytest
1212

1313
from tests.fixtures.services.util import (
@@ -70,7 +70,7 @@ def xvfb_watcher(
7070
with file_lock(
7171
os.path.join(lock_dir, 'xvfb_{0}.lock'.format(display)),
7272
operation=fcntl.LOCK_EX | fcntl.LOCK_NB):
73-
xvfb = find_executable('Xvfb')
73+
xvfb = which('Xvfb')
7474
assert xvfb, 'You have to have Xvfb installed'
7575
cmd = (
7676
'{xvfb} '

pytest_services/service.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import subprocess
99
import uuid # pylint: disable=C0411
1010

11-
from distutils.spawn import find_executable # pylint: disable=E0611
11+
from shutil import which
1212
import pytest
1313

1414
WRONG_FILE_NAME_CHARS_RE = re.compile(r'[^\w_-]')
@@ -70,7 +70,7 @@ def watcher_getter_function(name, arguments=None, kwargs=None, timeout=20, check
7070
if request is None:
7171
warnings.warn('Omitting the `request` parameter will result in an unstable order of finalizers.')
7272
request = orig_request
73-
executable = find_executable(name)
73+
executable = which(name)
7474
assert executable, 'You have to install {0} executable.'.format(name)
7575

7676
cmd = [name] + (arguments or [])

0 commit comments

Comments
 (0)