Refactorred test.

This commit is contained in:
Jeff Baskin 2022-06-19 08:30:50 -04:00
parent ca69bb4b0a
commit 72df9189a6
1 changed files with 1 additions and 5 deletions

View File

@ -20,7 +20,6 @@ class Server:
self.datadir.mkdir(parents=True)
self.settings = {}
self.use_config = True
# self.env = {}
self.process = None
self.loop = get_event_loop()
@ -77,12 +76,9 @@ class Server:
def set_safe_port(self):
"""Set the server port to something not being used."""
port = 9090
address = self.base_url.split(":")[0]
while port == 9090:
sock = socket()
if "address" in self.settings:
address = self.settings["address"]
else:
address = "127.0.0.1"
sock.bind((address, 0))
port = sock.getsockname()[1]
sock.close()