Skip to content

Quit the driver when logging in fails in the test fixture - #1539

Merged
adamtheturtle merged 1 commit into
mainfrom
adamtheturtle/vws-web-tools-issue-1497
Aug 27, 2026
Merged

Quit the driver when logging in fails in the test fixture#1539
adamtheturtle merged 1 commit into
mainfrom
adamtheturtle/vws-web-tools-issue-1497

Conversation

@adamtheturtle

Copy link
Copy Markdown
Member

Closes #1497.

fixture_logged_in_chrome_driver created a driver, logged in, and quit it in the code after yield. Everything after yield in a generator fixture is tear down, and tear down does not run for a fixture that raised before yielding — so when log_in fails, the browser and the ChromeDriver service it started are never stopped. log_in is wrapped in the tenacity retry, so the failure mode this hits is exactly a login that has retried five times and given up: it leaks a Chrome and a chromedriver, and because the fixture is module-scoped it does that once per module.

Selenium's WebDriver is already a context manager whose __exit__ calls quit(), so moving log_in and the yield inside with vws_web_tools.create_chrome_driver() as driver: guarantees cleanup on that path without adding any API. fixture_chrome_driver gets the same shape for consistency, though it was never at risk — it yields immediately.

On the library side there is nothing to fix here: log_in does not create a driver, so its retries cannot leak one, and every CLI command already quits in a finally.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YJDy3qA1LyNTh11zS98ukM

Closes #1497

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJDy3qA1LyNTh11zS98ukM
@adamtheturtle
adamtheturtle force-pushed the adamtheturtle/vws-web-tools-issue-1497 branch from 50f03d5 to 92dbdf1 Compare August 27, 2026 08:05
@adamtheturtle
adamtheturtle merged commit 95d0694 into main Aug 27, 2026
34 of 36 checks passed
@adamtheturtle
adamtheturtle deleted the adamtheturtle/vws-web-tools-issue-1497 branch August 27, 2026 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No explicit ChromeDriver service cleanup on partial login failure across retries

1 participant