Fix test failing on python 3.10

This commit is contained in:
Kovid Goyal 2021-12-13 20:11:30 +05:30
parent a445a73e66
commit 821f71cc4c
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -5,12 +5,8 @@
__license__ = 'GPL v3'
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
import subprocess, os, time
import subprocess, os, time, shutil
from collections import namedtuple
try:
from distutils.spawn import find_executable
except ImportError: # windows
find_executable = lambda x: None
from calibre.ptempfile import TemporaryDirectory
from calibre.srv.errors import HTTPForbidden
@ -234,7 +230,7 @@ class TestAuth(BaseTest):
self.ae(urlopen(server).read(), b'closed')
# Check using curl
curl = find_executable('curl')
curl = shutil.which('curl')
if curl:
def docurl(data, *args):
cmd = [curl] + list(args) + ['http://localhost:%d/closed' % server.address[1]]