Skip to content

Commit

Permalink
tests: add test for log leak
Browse files Browse the repository at this point in the history
This is fixed in #352, and here is the test for it.
  • Loading branch information
csernazs committed Aug 11, 2024
1 parent 862d4af commit 967d54e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/test_log_leak.py
Original file line number Diff line number Diff line change
@@ -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 == []
1 change: 1 addition & 0 deletions tests/test_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 967d54e

Please sign in to comment.