* Support pyftpdlib 2.0 in the testsuite. - Drop Requires on psutil and pytz, undeclared. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-fs?expand=0&rev=38
76 lines
2.6 KiB
Diff
76 lines
2.6 KiB
Diff
From a3a1005715adebcaabafc93d36369783d7fc5f9f Mon Sep 17 00:00:00 2001
|
|
From: "Benjamin A. Beasley" <code@musicinmybrain.net>
|
|
Date: Sat, 14 Jun 2025 07:47:07 -0400
|
|
Subject: [PATCH] Make tests compatible with pyftpdlib 2.0
|
|
|
|
Inspired by @mweinelt via
|
|
https://github.com/PyFilesystem/pyfilesystem2/pull/591.
|
|
---
|
|
tests/requirements.txt | 12 ++++--------
|
|
tests/test_ftpfs.py | 8 ++++----
|
|
2 files changed, 8 insertions(+), 12 deletions(-)
|
|
|
|
diff --git a/tests/requirements.txt b/tests/requirements.txt
|
|
index b7ff3ce4..0db1f97b 100644
|
|
--- a/tests/requirements.txt
|
|
+++ b/tests/requirements.txt
|
|
@@ -1,14 +1,10 @@
|
|
# the bare requirements for running tests
|
|
|
|
# pyftpdlib is needed to spawn a FTP server for the
|
|
-# FTPFS test suite
|
|
-pyftpdlib ~=1.5
|
|
-
|
|
-# these are optional dependencies for pyftpdlib that
|
|
-# are not explicitly listed, we need to install these
|
|
-# ourselves
|
|
-psutil ~=5.0
|
|
-pysendfile ~=2.0 ; python_version <= "3.3"
|
|
+# FTPFS test suite; we import from pyftpdlib.test, so
|
|
+# we need (at least some of) pyftpdlib's test
|
|
+# dependencies
|
|
+pyftpdlib[test] ~=2.0
|
|
|
|
# mock is only available from Python 3.3 onward, and
|
|
# mock v4+ doesn't support Python 2.7 anymore
|
|
diff --git a/tests/test_ftpfs.py b/tests/test_ftpfs.py
|
|
index 2bb2c73c..a3cfb04a 100644
|
|
--- a/tests/test_ftpfs.py
|
|
+++ b/tests/test_ftpfs.py
|
|
@@ -146,7 +146,7 @@ class TestFTPFS(FSTestCases, unittest.TestCase):
|
|
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
- from pyftpdlib.test import ThreadedTestFTPd
|
|
+ from pyftpdlib.test import FtpdThreadWrapper
|
|
|
|
super(TestFTPFS, cls).setUpClass()
|
|
|
|
@@ -154,7 +154,7 @@ def setUpClass(cls):
|
|
cls._temp_path = os.path.join(cls._temp_dir, text_type(uuid.uuid4()))
|
|
os.mkdir(cls._temp_path)
|
|
|
|
- cls.server = ThreadedTestFTPd()
|
|
+ cls.server = FtpdThreadWrapper()
|
|
cls.server.shutdown_after = -1
|
|
cls.server.handler.authorizer = DummyAuthorizer()
|
|
cls.server.handler.authorizer.add_user(
|
|
@@ -336,7 +336,7 @@ class TestAnonFTPFS(FSTestCases, unittest.TestCase):
|
|
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
- from pyftpdlib.test import ThreadedTestFTPd
|
|
+ from pyftpdlib.test import FtpdThreadWrapper
|
|
|
|
super(TestAnonFTPFS, cls).setUpClass()
|
|
|
|
@@ -344,7 +344,7 @@ def setUpClass(cls):
|
|
cls._temp_path = os.path.join(cls._temp_dir, text_type(uuid.uuid4()))
|
|
os.mkdir(cls._temp_path)
|
|
|
|
- cls.server = ThreadedTestFTPd()
|
|
+ cls.server = FtpdThreadWrapper()
|
|
cls.server.shutdown_after = -1
|
|
cls.server.handler.authorizer = DummyAuthorizer()
|
|
cls.server.handler.authorizer.add_anonymous(cls._temp_path, perm="elradfmw")
|