Skip to content

Commit 2fed2b6

Browse files
committed
tests: add test for log leak
This is fixed in csernazs#352, and here is the test for it.
1 parent 862d4af commit 2fed2b6

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

tests/test_log_leak.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import pytest
2+
import requests
3+
4+
from pytest_httpserver import HTTPServer
5+
6+
7+
class Client:
8+
def __init__(self) -> None:
9+
self.url: str | None = None
10+
11+
def get(self):
12+
if self.url:
13+
requests.get(self.url)
14+
15+
16+
@pytest.fixture()
17+
def my_fixture():
18+
client = Client()
19+
yield client
20+
client.get()
21+
22+
23+
def test_1(my_fixture: Client, httpserver: HTTPServer):
24+
httpserver.expect_request("/foo").respond_with_data("OK")
25+
my_fixture.url = httpserver.url_for("/foo")
26+
27+
28+
def test_2(httpserver: HTTPServer):
29+
assert httpserver.log == []

tests/test_release.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ def test_sdist_contents(build: Build, version: str):
212212
"test_hooks.py",
213213
"test_ip_protocols.py",
214214
"test_json_matcher.py",
215+
"test_log_leak.py",
215216
"test_log_querying.py",
216217
"test_mixed.py",
217218
"test_oneshot.py",

0 commit comments

Comments
 (0)