Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tests/testutils/bearer_http_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import multiprocessing
import threading
import os
import posixpath
import html
Expand Down Expand Up @@ -87,7 +87,7 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)


class BearerHttpServer(multiprocessing.Process):
class BearerHttpServer(threading.Thread):
def __init__(self):
super().__init__()
self.server = BearerHTTPServer(("127.0.0.1", 0), BearerRequestHandler)
Expand All @@ -103,7 +103,7 @@ def run(self):
def stop(self):
if not self.started:
return
self.terminate()
self.server.shutdown()
self.join()

def set_directory(self, directory):
Expand Down
10 changes: 4 additions & 6 deletions tests/testutils/ftp_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,26 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import multiprocessing
import threading

from pyftpdlib.authorizers import DummyAuthorizer
from pyftpdlib.handlers import FTPHandler
from pyftpdlib.servers import FTPServer
from pyftpdlib.servers import ThreadedFTPServer


class SimpleFtpServer(multiprocessing.Process):
class SimpleFtpServer(threading.Thread):
def __init__(self):
super().__init__()
self.authorizer = DummyAuthorizer()
handler = FTPHandler
handler.authorizer = self.authorizer
self.server = FTPServer(("127.0.0.1", 0), handler)
self.server = ThreadedFTPServer(("127.0.0.1", 0), handler)

def run(self):
self.server.serve_forever()

def stop(self):
self.server.close_all()
self.server.close()
self.terminate()
self.join()

def allow_anonymous(self, cwd):
Expand Down
6 changes: 3 additions & 3 deletions tests/testutils/http_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import multiprocessing
import threading
import os
import posixpath
import html
Expand Down Expand Up @@ -93,7 +93,7 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)


class SimpleHttpServer(multiprocessing.Process):
class SimpleHttpServer(threading.Thread):
def __init__(self):
super().__init__()
self.server = AuthHTTPServer(("127.0.0.1", 0), RequestHandler)
Expand All @@ -109,7 +109,7 @@ def run(self):
def stop(self):
if not self.started:
return
self.terminate()
self.server.shutdown()
self.join()

def allow_anonymous(self, cwd):
Expand Down
Loading