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