Refactorred test.
This commit is contained in:
parent
ca69bb4b0a
commit
72df9189a6
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user