Skip to content

Commit 5aee361

Browse files
Skn0ttCopilot
andcommitted
chore(tests): rely on context fixture for page cleanup
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 93944f7c-c521-4248-936d-d4240acd29fc
1 parent 8d535ad commit 5aee361

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

‎tests/async/conftest.py‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,8 @@ async def context(
128128

129129

130130
@pytest.fixture
131-
async def page(context: BrowserContext) -> AsyncGenerator[Page, None]:
132-
page = await context.new_page()
133-
yield page
134-
await page.close()
131+
async def page(context: BrowserContext) -> Page:
132+
return await context.new_page()
135133

136134

137135
@pytest.fixture(scope="session")

‎tests/sync/conftest.py‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,8 @@ def context(browser: Browser) -> Generator[BrowserContext, None, None]:
8282

8383

8484
@pytest.fixture
85-
def page(context: BrowserContext) -> Generator[Page, None, None]:
86-
page = context.new_page()
87-
yield page
88-
page.close()
85+
def page(context: BrowserContext) -> Page:
86+
return context.new_page()
8987

9088

9189
@pytest.fixture(scope="session")

0 commit comments

Comments
 (0)