diff --git a/tests/test_log_leak.py b/tests/test_log_leak.py new file mode 100644 index 00000000..fa6ffcfd --- /dev/null +++ b/tests/test_log_leak.py @@ -0,0 +1,29 @@ +import pytest +import requests + +from pytest_httpserver import HTTPServer + + +class Client: + def __init__(self) -> None: + self.url: str | None = None + + def get(self): + if self.url: + requests.get(self.url) + + +@pytest.fixture() +def my_fixture(): + client = Client() + yield client + client.get() + + +def test_1(my_fixture: Client, httpserver: HTTPServer): + httpserver.expect_request("/foo").respond_with_data("OK") + my_fixture.url = httpserver.url_for("/foo") + + +def test_2(httpserver: HTTPServer): + assert httpserver.log == [] diff --git a/tests/test_release.py b/tests/test_release.py index ada1e782..4f8d2420 100644 --- a/tests/test_release.py +++ b/tests/test_release.py @@ -212,6 +212,7 @@ def test_sdist_contents(build: Build, version: str): "test_hooks.py", "test_ip_protocols.py", "test_json_matcher.py", + "test_log_leak.py", "test_log_querying.py", "test_mixed.py", "test_oneshot.py",