mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 19:01:39 -04:00
Trying to get new client when port is already in use.
This commit is contained in:
parent
459de4de32
commit
dae780e02f
1 changed files with 13 additions and 3 deletions
|
|
@ -135,9 +135,19 @@ def test_client() -> ReusableClient:
|
|||
api_app.blueprint(bp)
|
||||
ROUTES_ATTACHED = True
|
||||
|
||||
client = ReusableClient(api_app)
|
||||
with client:
|
||||
yield client
|
||||
for _ in range(5):
|
||||
# Sometimes the Sanic client tries to use a port already in use, try again...
|
||||
try:
|
||||
client = ReusableClient(api_app)
|
||||
with client:
|
||||
yield client
|
||||
break
|
||||
except OSError as e:
|
||||
# Ignore errors where the port was already in use.
|
||||
if 'address already in use' not in str(e):
|
||||
raise
|
||||
else:
|
||||
raise RuntimeError('Test never got unused port')
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue