-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
Atfinity is using your SFTP Server in our Django tests (without pytest) nicely like so:
mock_sftp_server = SFTPServer()
class TestSFTP(APITestCase):
fixtures = ['simple.json']
@classmethod
def setUpClass(cls):
super().setUpClass()
mock_sftp_server.block_on_close = False
mock_sftp_server.start()
print('Started Mock SFTP Server ...') # noqa
@classmethod
def tearDownClass(cls) -> None:
super().tearDownClass()
mock_sftp_server.server_close()
mock_sftp_server.shutdown()
mock_sftp_server.join(0)
print('Shut down Mock SFTP Server ...') # noqa
...
However, threads never close. For this, we had to set the threads created by ThreadingMixin to be demon threads and not block like so:
class TestSFTPServer(SFTPServer):
daemon_threads = True
block_on_close = False
As this seems to have no negative effect on the functionality, we suggest to do this for SFTPServer directly to make this package useful for django tests. Happy to provide more info how to use this within django tests.
628567
Metadata
Metadata
Assignees
Labels
No labels