diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index dfafa981..07ff515b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,7 +16,7 @@ jobs: fail-fast: false matrix: python-version: ["3.11"] - os: [ubuntu-latest, windows-latest] + os: [ubuntu-latest, windows-latest, macos-latest] steps: - uses: actions/checkout@v4 diff --git a/pyftpdlib/test/__init__.py b/pyftpdlib/test/__init__.py index 4010000f..5a359809 100644 --- a/pyftpdlib/test/__init__.py +++ b/pyftpdlib/test/__init__.py @@ -58,6 +58,7 @@ IS_64BIT = sys.maxsize > 2**32 OSX = sys.platform.startswith("darwin") POSIX = os.name == 'posix' +BSD = "bsd" in sys.platform WINDOWS = os.name == 'nt' LOG_FMT = "[%(levelname)1.1s t: %(threadName)-15s p: %(processName)-25s " LOG_FMT += "@%(module)-12s: %(lineno)-4s] %(message)s" diff --git a/pyftpdlib/test/test_functional.py b/pyftpdlib/test/test_functional.py index b24f0e90..7cb47eeb 100644 --- a/pyftpdlib/test/test_functional.py +++ b/pyftpdlib/test/test_functional.py @@ -51,7 +51,6 @@ from pyftpdlib.test import SUPPORTS_SENDFILE from pyftpdlib.test import USER from pyftpdlib.test import WINDOWS -from pyftpdlib.test import MProcessTestFTPd from pyftpdlib.test import PyftpdlibTestCase from pyftpdlib.test import ThreadedTestFTPd from pyftpdlib.test import close_client @@ -69,7 +68,7 @@ class TestFtpAuthentication(PyftpdlibTestCase): """Test: USER, PASS, REIN.""" - server_class = MProcessTestFTPd + server_class = ThreadedTestFTPd client_class = ftplib.FTP def setUp(self): @@ -259,7 +258,7 @@ def test_user_during_transfer(self): class TestFtpDummyCmds(PyftpdlibTestCase): """Test: TYPE, STRU, MODE, NOOP, SYST, ALLO, HELP, SITE HELP.""" - server_class = MProcessTestFTPd + server_class = ThreadedTestFTPd client_class = ftplib.FTP def setUp(self): @@ -396,7 +395,7 @@ def mlst(): class TestFtpCmdsSemantic(PyftpdlibTestCase): - server_class = MProcessTestFTPd + server_class = ThreadedTestFTPd client_class = ftplib.FTP arg_cmds = [ 'allo', @@ -513,7 +512,7 @@ class TestFtpFsOperations(PyftpdlibTestCase): STAT, MFMT. """ - server_class = MProcessTestFTPd + server_class = ThreadedTestFTPd client_class = ftplib.FTP def setUp(self): @@ -750,7 +749,7 @@ def write(self, b): class TestFtpStoreData(PyftpdlibTestCase): """Test STOR, STOU, APPE, REST, TYPE.""" - server_class = MProcessTestFTPd + server_class = ThreadedTestFTPd client_class = ftplib.FTP use_sendfile = None use_custom_io = False @@ -1061,7 +1060,7 @@ class TestFtpStoreDataWithCustomIO(TestFtpStoreData): class TestFtpRetrieveData(PyftpdlibTestCase): """Test RETR, REST, TYPE.""" - server_class = MProcessTestFTPd + server_class = ThreadedTestFTPd client_class = ftplib.FTP use_sendfile = None use_custom_io = False @@ -1204,7 +1203,7 @@ class TestFtpRetrieveDataCustomIO(TestFtpRetrieveData): class TestFtpListingCmds(PyftpdlibTestCase): """Test LIST, NLST, argumented STAT.""" - server_class = MProcessTestFTPd + server_class = ThreadedTestFTPd client_class = ftplib.FTP def setUp(self): @@ -1369,7 +1368,7 @@ def test_unforeseen_time_event(self): class TestFtpAbort(PyftpdlibTestCase): """Test: ABOR.""" - server_class = MProcessTestFTPd + server_class = ThreadedTestFTPd client_class = ftplib.FTP def setUp(self): @@ -1457,7 +1456,7 @@ def test_oob_abor(self): class TestThrottleBandwidth(PyftpdlibTestCase): """Test ThrottledDTPHandler class.""" - server_class = MProcessTestFTPd + server_class = ThreadedTestFTPd client_class = ftplib.FTP def setUp(self): @@ -1531,7 +1530,7 @@ class TestTimeouts(PyftpdlibTestCase): Some tests may fail on slow machines. """ - server_class = MProcessTestFTPd + server_class = ThreadedTestFTPd client_class = ftplib.FTP def setUp(self): @@ -1697,7 +1696,7 @@ def test_disabled_port_timeout(self): class TestConfigurableOptions(PyftpdlibTestCase): """Test those daemon options which are commonly modified by user.""" - server_class = MProcessTestFTPd + server_class = ThreadedTestFTPd client_class = ftplib.FTP def setUp(self): @@ -1937,7 +1936,7 @@ def test_use_gmt_times(self): class TestCallbacks(PyftpdlibTestCase): - server_class = MProcessTestFTPd + server_class = ThreadedTestFTPd client_class = ftplib.FTP def setUp(self): @@ -2250,7 +2249,7 @@ class TestIPv4Environment(_TestNetworkProtocols, PyftpdlibTestCase): plus some additional specific tests. """ - server_class = MProcessTestFTPd + server_class = ThreadedTestFTPd client_class = ftplib.FTP HOST = '127.0.0.1' @@ -2300,7 +2299,7 @@ class TestIPv6Environment(_TestNetworkProtocols, PyftpdlibTestCase): plus some additional specific tests. """ - server_class = MProcessTestFTPd + server_class = ThreadedTestFTPd client_class = ftplib.FTP HOST = '::1' @@ -2336,7 +2335,7 @@ class TestIPv6MixedEnvironment(PyftpdlibTestCase): manner and try to connect by using an IPv4 client. """ - server_class = MProcessTestFTPd + server_class = ThreadedTestFTPd client_class = ftplib.FTP HOST = "::" @@ -2418,7 +2417,7 @@ class TestCornerCases(PyftpdlibTestCase): mainly referring to bugs signaled on the bug tracker. """ - server_class = MProcessTestFTPd + server_class = ThreadedTestFTPd client_class = ftplib.FTP def setUp(self): @@ -2554,7 +2553,7 @@ def test_ioloop_fileno(self): # """Test FTP commands and responses by using path names with non # ASCII characters. # """ -# server_class = MProcessTestFTPd +# server_class = ThreadedTestFTPd # client_class = ftplib.FTP # def setUp(self): diff --git a/pyftpdlib/test/test_functional_ssl.py b/pyftpdlib/test/test_functional_ssl.py index fe12585f..861daf6c 100644 --- a/pyftpdlib/test/test_functional_ssl.py +++ b/pyftpdlib/test/test_functional_ssl.py @@ -19,8 +19,8 @@ from pyftpdlib.test import PASSWD from pyftpdlib.test import USER from pyftpdlib.test import WINDOWS -from pyftpdlib.test import MProcessTestFTPd from pyftpdlib.test import PyftpdlibTestCase +from pyftpdlib.test import ThreadedTestFTPd from pyftpdlib.test import close_client from pyftpdlib.test.test_functional import TestConfigurableOptions from pyftpdlib.test.test_functional import TestCornerCases @@ -64,7 +64,7 @@ def login(self, *args, **kwargs): self.prot_p() -class FTPSServer(MProcessTestFTPd): +class FTPSServer(ThreadedTestFTPd): """A threaded FTPS server used for functional testing.""" handler = TLS_FTPHandler diff --git a/pyftpdlib/test/test_servers.py b/pyftpdlib/test/test_servers.py index a3e66546..dce8c521 100644 --- a/pyftpdlib/test/test_servers.py +++ b/pyftpdlib/test/test_servers.py @@ -11,8 +11,11 @@ from pyftpdlib import handlers from pyftpdlib import servers from pyftpdlib._compat import super +from pyftpdlib.test import BSD +from pyftpdlib.test import GITHUB_ACTIONS from pyftpdlib.test import GLOBAL_TIMEOUT from pyftpdlib.test import HOST +from pyftpdlib.test import OSX from pyftpdlib.test import PASSWD from pyftpdlib.test import USER from pyftpdlib.test import WINDOWS @@ -33,6 +36,8 @@ MPROCESS_SUPPORT = hasattr(servers, 'MultiprocessFTPServer') +if BSD or OSX and GITHUB_ACTIONS: + MPROCESS_SUPPORT = False # XXX: it's broken!! class TestFTPServer(PyftpdlibTestCase):