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