Skip to content

Commit a3a1005

Browse files
Make tests compatible with pyftpdlib 2.0
Inspired by @mweinelt via PyFilesystem#591.
1 parent 77a8562 commit a3a1005

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

tests/requirements.txt

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
# the bare requirements for running tests
22

33
# pyftpdlib is needed to spawn a FTP server for the
4-
# FTPFS test suite
5-
pyftpdlib ~=1.5
6-
7-
# these are optional dependencies for pyftpdlib that
8-
# are not explicitly listed, we need to install these
9-
# ourselves
10-
psutil ~=5.0
11-
pysendfile ~=2.0 ; python_version <= "3.3"
4+
# FTPFS test suite; we import from pyftpdlib.test, so
5+
# we need (at least some of) pyftpdlib's test
6+
# dependencies
7+
pyftpdlib[test] ~=2.0
128

139
# mock is only available from Python 3.3 onward, and
1410
# mock v4+ doesn't support Python 2.7 anymore

tests/test_ftpfs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,15 @@ class TestFTPFS(FSTestCases, unittest.TestCase):
146146

147147
@classmethod
148148
def setUpClass(cls):
149-
from pyftpdlib.test import ThreadedTestFTPd
149+
from pyftpdlib.test import FtpdThreadWrapper
150150

151151
super(TestFTPFS, cls).setUpClass()
152152

153153
cls._temp_dir = tempfile.mkdtemp("ftpfs2tests")
154154
cls._temp_path = os.path.join(cls._temp_dir, text_type(uuid.uuid4()))
155155
os.mkdir(cls._temp_path)
156156

157-
cls.server = ThreadedTestFTPd()
157+
cls.server = FtpdThreadWrapper()
158158
cls.server.shutdown_after = -1
159159
cls.server.handler.authorizer = DummyAuthorizer()
160160
cls.server.handler.authorizer.add_user(
@@ -336,15 +336,15 @@ class TestAnonFTPFS(FSTestCases, unittest.TestCase):
336336

337337
@classmethod
338338
def setUpClass(cls):
339-
from pyftpdlib.test import ThreadedTestFTPd
339+
from pyftpdlib.test import FtpdThreadWrapper
340340

341341
super(TestAnonFTPFS, cls).setUpClass()
342342

343343
cls._temp_dir = tempfile.mkdtemp("ftpfs2tests")
344344
cls._temp_path = os.path.join(cls._temp_dir, text_type(uuid.uuid4()))
345345
os.mkdir(cls._temp_path)
346346

347-
cls.server = ThreadedTestFTPd()
347+
cls.server = FtpdThreadWrapper()
348348
cls.server.shutdown_after = -1
349349
cls.server.handler.authorizer = DummyAuthorizer()
350350
cls.server.handler.authorizer.add_anonymous(cls._temp_path, perm="elradfmw")

0 commit comments

Comments
 (0)