From 16ab859b4c4820531664322d42efb193087efdd2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 2 May 2026 07:48:56 +0000 Subject: [PATCH 1/3] Initial plan From 7a788c57f9674bc709bc8602255cae930c0b89f8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 2 May 2026 07:49:45 +0000 Subject: [PATCH 2/3] Fix URL normalization and fixture yield consistency in test_aes_session Agent-Logs-Url: https://github.com/PoorHttp/PoorWSGI/sessions/4da95014-475b-4e6a-b9c5-c49a53c320bb Co-authored-by: ondratu <6469029+ondratu@users.noreply.github.com> --- tests_integrity/test_aes_session.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/tests_integrity/test_aes_session.py b/tests_integrity/test_aes_session.py index a629da7..ecdd975 100644 --- a/tests_integrity/test_aes_session.py +++ b/tests_integrity/test_aes_session.py @@ -7,7 +7,6 @@ from .support import check_url, start_server -# pylint: disable=inconsistent-return-statements # pylint: disable=missing-function-docstring # pylint: disable=no-self-use # pylint: disable=redefined-outer-name @@ -16,17 +15,19 @@ @fixture(scope="module") def url(request): """The URL (server fixture).""" - val = environ.get("TEST_AES_SESSION_URL", "").strip('/') + process = None + val = environ.get("TEST_AES_SESSION_URL", "").rstrip('/') if val: - return val - - process = start_server( - request, - join(dirname(__file__), pardir, 'examples/aes_session.py')) - - yield "http://localhost:8080" # server is running - process.kill() - process.wait() + yield val + else: + process = start_server( + request, + join(dirname(__file__), pardir, 'examples/aes_session.py')) + yield "http://localhost:8080" # server is running + + if process is not None: + process.kill() + process.wait() @fixture From e89a1842c1b903b13873c441768f9ab06cd2c767 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 2 May 2026 07:58:50 +0000 Subject: [PATCH 3/3] Apply rstrip and consistent yield fixture pattern to all integrity tests Agent-Logs-Url: https://github.com/PoorHttp/PoorWSGI/sessions/38710ba9-3b36-428e-bc88-28e266a492ff Co-authored-by: ondratu <6469029+ondratu@users.noreply.github.com> --- tests_integrity/test_digest.py | 23 ++++++++++++----------- tests_integrity/test_json.py | 23 ++++++++++++----------- tests_integrity/test_metrics.py | 21 +++++++++++---------- tests_integrity/test_openapi.py | 25 +++++++++++++------------ tests_integrity/test_profile.py | 25 +++++++++++++------------ tests_integrity/test_session.py | 23 ++++++++++++----------- tests_integrity/test_simple.py | 25 +++++++++++++------------ tests_integrity/test_websocket.py | 23 ++++++++++++----------- 8 files changed, 98 insertions(+), 90 deletions(-) diff --git a/tests_integrity/test_digest.py b/tests_integrity/test_digest.py index a4feae7..bf1c489 100644 --- a/tests_integrity/test_digest.py +++ b/tests_integrity/test_digest.py @@ -7,7 +7,6 @@ from .support import check_url, start_server -# pylint: disable=inconsistent-return-statements # pylint: disable=missing-function-docstring # pylint: disable=redefined-outer-name # pylint: disable=no-self-use @@ -16,17 +15,19 @@ @fixture(scope="module") def url(request): """The URL (server fixture).""" - val = environ.get("TEST_DIGEST_URL", "").strip('/') + process = None + val = environ.get("TEST_DIGEST_URL", "").rstrip('/') if val: - return val - - process = start_server( - request, - join(dirname(__file__), pardir, 'examples/http_digest.py')) - - yield "http://localhost:8080" # server is running - process.kill() - process.wait() + yield val + else: + process = start_server( + request, + join(dirname(__file__), pardir, 'examples/http_digest.py')) + yield "http://localhost:8080" # server is running + + if process is not None: + process.kill() + process.wait() @fixture diff --git a/tests_integrity/test_json.py b/tests_integrity/test_json.py index 043dd46..bf1cb22 100644 --- a/tests_integrity/test_json.py +++ b/tests_integrity/test_json.py @@ -8,7 +8,6 @@ from . support import start_server, check_url # pylint: disable=missing-function-docstring -# pylint: disable=inconsistent-return-statements # pylint: disable=redefined-outer-name # pylint: disable=no-self-use # pylint: disable=consider-using-f-string @@ -17,17 +16,19 @@ @fixture(scope="module") def server(request): """Fixture for starting the JSON example server.""" - value = environ.get("TEST_SIMPLE_JSON_URL", "").strip('/') + process = None + value = environ.get("TEST_SIMPLE_JSON_URL", "").rstrip('/') if value: - return value - - process = start_server( - request, - join(dirname(__file__), pardir, 'examples/simple_json.py')) - - yield "http://localhost:8080" # server is running - process.kill() - process.wait() + yield value + else: + process = start_server( + request, + join(dirname(__file__), pardir, 'examples/simple_json.py')) + yield "http://localhost:8080" # server is running + + if process is not None: + process.kill() + process.wait() class TestHeaders: diff --git a/tests_integrity/test_metrics.py b/tests_integrity/test_metrics.py index 08445fb..1f513a2 100644 --- a/tests_integrity/test_metrics.py +++ b/tests_integrity/test_metrics.py @@ -15,18 +15,19 @@ def url(request): """Returns the server URL or starts the metrics application if it doesn't exist.""" - retval = environ.get("TEST_METRICS_URL", "").strip('/') + process = None + retval = environ.get("TEST_METRICS_URL", "").rstrip('/') if retval: yield retval - return - - process = start_server( - request, - join(dirname(__file__), pardir, 'examples/metrics.py')) - - yield "http://localhost:8080" # server is running - process.kill() - process.wait() + else: + process = start_server( + request, + join(dirname(__file__), pardir, 'examples/metrics.py')) + yield "http://localhost:8080" # server is running + + if process is not None: + process.kill() + process.wait() class TestMetrics(): diff --git a/tests_integrity/test_openapi.py b/tests_integrity/test_openapi.py index 501a9e0..294f89a 100644 --- a/tests_integrity/test_openapi.py +++ b/tests_integrity/test_openapi.py @@ -19,18 +19,19 @@ @fixture(scope="module") def url(request): """Fixture for starting the OpenAPI example server.""" - url = environ.get("TEST_OPENAPI_URL", "").strip('/') - if url: - yield url - return - - process = start_server( - request, - join(dirname(__file__), pardir, 'examples/openapi3.py')) - - yield "http://localhost:8080" # server is running - process.kill() - process.wait() + process = None + val = environ.get("TEST_OPENAPI_URL", "").rstrip('/') + if val: + yield val + else: + process = start_server( + request, + join(dirname(__file__), pardir, 'examples/openapi3.py')) + yield "http://localhost:8080" # server is running + + if process is not None: + process.kill() + process.wait() @fixture diff --git a/tests_integrity/test_profile.py b/tests_integrity/test_profile.py index 26a06dd..eda52d1 100644 --- a/tests_integrity/test_profile.py +++ b/tests_integrity/test_profile.py @@ -7,7 +7,6 @@ from . support import start_server, check_url # pylint: disable=missing-function-docstring -# pylint: disable=inconsistent-return-statements # pylint: disable=redefined-outer-name # pylint: disable=no-self-use # pylint: disable=consider-using-f-string @@ -17,18 +16,20 @@ @fixture(scope="module") def server(request): """Fixture for starting the profiling JSON example server.""" - value = environ.get("TEST_SIMPLE_JSON_URL", "").strip('/') + process = None + value = environ.get("TEST_SIMPLE_JSON_URL", "").rstrip('/') if value: - return value - - process = start_server( - request, - join(dirname(__file__), pardir, 'examples/simple_json.py'), - {"PROFILE": "1"}) - - yield "http://localhost:8080" # server is running - process.kill() - process.wait() + yield value + else: + process = start_server( + request, + join(dirname(__file__), pardir, 'examples/simple_json.py'), + {"PROFILE": "1"}) + yield "http://localhost:8080" # server is running + + if process is not None: + process.kill() + process.wait() class TestRequest: diff --git a/tests_integrity/test_session.py b/tests_integrity/test_session.py index 3cc40ff..9e53b95 100644 --- a/tests_integrity/test_session.py +++ b/tests_integrity/test_session.py @@ -7,7 +7,6 @@ from .support import check_url, start_server -# pylint: disable=inconsistent-return-statements # pylint: disable=missing-function-docstring # pylint: disable=no-self-use # pylint: disable=redefined-outer-name @@ -16,17 +15,19 @@ @fixture(scope="module") def url(request): """The URL (server fixture).""" - val = environ.get("TEST_SESSION_URL", "").strip('/') + process = None + val = environ.get("TEST_SESSION_URL", "").rstrip('/') if val: - return val - - process = start_server( - request, - join(dirname(__file__), pardir, 'examples/session.py')) - - yield "http://localhost:8080" # server is running - process.kill() - process.wait() + yield val + else: + process = start_server( + request, + join(dirname(__file__), pardir, 'examples/session.py')) + yield "http://localhost:8080" # server is running + + if process is not None: + process.kill() + process.wait() @fixture diff --git a/tests_integrity/test_simple.py b/tests_integrity/test_simple.py index fb104de..4e899ef 100644 --- a/tests_integrity/test_simple.py +++ b/tests_integrity/test_simple.py @@ -7,7 +7,6 @@ from .support import check_url, start_server -# pylint: disable=inconsistent-return-statements # pylint: disable=missing-function-docstring # pylint: disable=no-self-use # pylint: disable=redefined-outer-name @@ -17,17 +16,19 @@ @fixture(scope="module") def url(request): """The URL (server fixture).""" - url = environ.get("TEST_SIMPLE_URL", "").strip('/') - if url: - return url - - process = start_server( - request, - join(dirname(__file__), pardir, 'examples/simple.py')) - - yield "http://localhost:8080" # server is running - process.kill() - process.wait() + process = None + val = environ.get("TEST_SIMPLE_URL", "").rstrip('/') + if val: + yield val + else: + process = start_server( + request, + join(dirname(__file__), pardir, 'examples/simple.py')) + yield "http://localhost:8080" # server is running + + if process is not None: + process.kill() + process.wait() @fixture diff --git a/tests_integrity/test_websocket.py b/tests_integrity/test_websocket.py index 5427099..572159d 100644 --- a/tests_integrity/test_websocket.py +++ b/tests_integrity/test_websocket.py @@ -10,7 +10,6 @@ from . support import start_server, check_url -# pylint: disable=inconsistent-return-statements # pylint: disable=missing-function-docstring # pylint: disable=redefined-outer-name # pylint: disable=no-self-use @@ -19,18 +18,20 @@ @fixture(scope="module") def server(request): """Fixture for starting the WebSocket example server.""" - value = environ.get("TEST_WEBSOCKET_URL", "").strip('/') + process = None + value = environ.get("TEST_WEBSOCKET_URL", "").rstrip('/') if value: - return value + yield value + else: + process = start_server( + request, + join(dirname(__file__), pardir, 'examples/websocket.py'), + close=False) + yield "localhost:8080" # server is running - process = start_server( - request, - join(dirname(__file__), pardir, 'examples/websocket.py'), - close=False) - - yield "localhost:8080" # server is running - process.kill() - process.wait() + if process is not None: + process.kill() + process.wait() @fixture(scope="module")