Skip to content

Commit 88cc81e

Browse files
committed
Explicitly close contexts in sync tests that were missing it
1 parent 3af6375 commit 88cc81e

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

tests/sync/test_har.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ def test_should_round_trip_har_zip(
443443
page_2.goto(server.PREFIX + "/one-style.html")
444444
assert "hello, world!" in page_2.content()
445445
expect(page_2.locator("body")).to_have_css("background-color", "rgb(255, 192, 203)")
446+
context_2.close()
446447

447448

448449
def test_should_round_trip_har_with_post_data(
@@ -476,6 +477,7 @@ def test_should_round_trip_har_with_post_data(
476477
assert page_2.evaluate(fetch_function, "3") == "3"
477478
with pytest.raises(Exception):
478479
page_2.evaluate(fetch_function, "4")
480+
context_2.close()
479481

480482

481483
def test_should_disambiguate_by_header(
@@ -517,6 +519,7 @@ def test_should_disambiguate_by_header(
517519
assert page_2.evaluate(fetch_function, "baz2") == "baz2"
518520
assert page_2.evaluate(fetch_function, "baz3") == "baz3"
519521
assert page_2.evaluate(fetch_function, "baz4") == "baz1"
522+
context_2.close()
520523

521524

522525
def test_should_produce_extracted_zip(
@@ -542,6 +545,7 @@ def test_should_produce_extracted_zip(
542545
page_2.goto(server.PREFIX + "/one-style.html")
543546
assert "hello, world!" in page_2.content()
544547
expect(page_2.locator("body")).to_have_css("background-color", "rgb(255, 192, 203)")
548+
context_2.close()
545549

546550

547551
def test_should_update_har_zip_for_context(
@@ -562,6 +566,7 @@ def test_should_update_har_zip_for_context(
562566
page_2.goto(server.PREFIX + "/one-style.html")
563567
assert "hello, world!" in page_2.content()
564568
expect(page_2.locator("body")).to_have_css("background-color", "rgb(255, 192, 203)")
569+
context_2.close()
565570

566571

567572
def test_should_update_har_zip_for_page(
@@ -582,6 +587,7 @@ def test_should_update_har_zip_for_page(
582587
page_2.goto(server.PREFIX + "/one-style.html")
583588
assert "hello, world!" in page_2.content()
584589
expect(page_2.locator("body")).to_have_css("background-color", "rgb(255, 192, 203)")
590+
context_2.close()
585591

586592

587593
def test_should_update_har_zip_for_page_with_different_options(
@@ -627,3 +633,4 @@ def test_should_update_extracted_har_zip_for_page(
627633
page_2.goto(server.PREFIX + "/one-style.html")
628634
assert "hello, world!" in page_2.content()
629635
expect(page_2.locator("body")).to_have_css("background-color", "rgb(255, 192, 203)")
636+
context_2.close()

tests/sync/test_route_web_socket.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ def _handle_ws(ws: WebSocketRoute) -> None:
340340
f"message: data=echo origin=ws://localhost:{server.PORT} lastEventId=",
341341
],
342342
)
343+
page.close()
343344

344345

345346
def test_should_work_with_no_trailing_slash(page: Page, server: Server) -> None:

tests/sync/test_tracing.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def test_browser_context_output_trace(
3939
page.goto(server.PREFIX + "/grid.html")
4040
context.tracing.stop(path=tmp_path / "trace.zip")
4141
assert Path(tmp_path / "trace.zip").exists()
42+
context.close()
4243

4344

4445
def test_start_stop(browser: Browser) -> None:
@@ -72,6 +73,7 @@ def test_browser_context_output_trace_chunk(
7273
button.click()
7374
context.tracing.stop_chunk(path=tmp_path / "trace2.zip")
7475
assert Path(tmp_path / "trace2.zip").exists()
76+
context.close()
7577

7678

7779
def test_should_collect_sources(

0 commit comments

Comments
 (0)