6027c8f
From e9b2ff8c37f2721f67caf634d964c946895c1816 Mon Sep 17 00:00:00 2001
6027c8f
From: Adam Williamson <awilliam@redhat.com>
6027c8f
Date: Tue, 23 Apr 2024 13:57:19 -0700
6027c8f
Subject: [PATCH] Fix tests with pytest-xprocess 1.0+
6027c8f
6027c8f
See https://github.com/pallets/werkzeug/issues/2875#issuecomment-2044203708
6027c8f
6027c8f
Signed-off-by: Adam Williamson <awilliam@redhat.com>
6027c8f
---
6027c8f
 tests/conftest.py | 10 ++++++----
6027c8f
 1 file changed, 6 insertions(+), 4 deletions(-)
6027c8f
6027c8f
diff --git a/tests/conftest.py b/tests/conftest.py
6027c8f
index b73202cd..905f3f4b 100644
6027c8f
--- a/tests/conftest.py
6027c8f
+++ b/tests/conftest.py
6027c8f
@@ -107,10 +107,12 @@ def dev_server(xprocess, request, tmp_path):
6027c8f
                 new_python_path = str(tmp_path)
6027c8f
             env = {**os.environ, "PYTHONPATH": new_python_path, "PYTHONUNBUFFERED": "1"}
6027c8f
 
6027c8f
-            @cached_property
6027c8f
-            def pattern(self):
6027c8f
-                client.request("/ensure")
6027c8f
-                return "GET /ensure"
6027c8f
+            def startup_check(self):
6027c8f
+                try:
6027c8f
+                    client.request("/ensure")
6027c8f
+                    return True
6027c8f
+                except (ConnectionRefusedError, FileNotFoundError):
6027c8f
+                    return False
6027c8f
 
6027c8f
         # Each test that uses the fixture will have a different log.
6027c8f
         xp_name = f"dev_server-{request.node.name}"
6027c8f
-- 
6027c8f
2.44.0
6027c8f