diff --git a/tests/test_svc.py b/tests/test_svc.py index f90e636d..816cb8f7 100644 --- a/tests/test_svc.py +++ b/tests/test_svc.py @@ -986,7 +986,9 @@ class SvcDbRecoveryTests(unittest.TestCase): htdocs = self.root / "static-site" htdocs.mkdir() (htdocs / "index.html").write_text("static-ok\n") - port = 18951 + with socket.socket() as reservation: + reservation.bind(("127.0.0.1", 0)) + port = reservation.getsockname()[1] result = self.svc( "uiqa", "deploy", "--kind", "static", "--dir", str(htdocs), "--addr", "127.0.0.1:%d" % port)