Skip to content

test: keep the test suite headless - #1425

Merged
inimaz merged 2 commits into
masterfrom
fix/tests-no-browser
Sep 23, 2026
Merged

inimaz merged 2 commits into
masterfrom
fix/tests-no-browser

Conversation

@davidberenstein1957

@davidberenstein1957 davidberenstein1957 commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

Description

Two tests in tests/cli/test_cli_auth.py (test_authorize_raises_on_callback_error and test_authorize_raises_when_no_callback_received) called auth.authorize() without patching webbrowser.open, so running the test suite opened https://auth.example/authorize in the system browser. The PR adds an autouse fixture in tests/conftest.py that stubs webbrowser.open for every test. Tests that patch it explicitly, such as test_authorize_success, still take precedence.

Related Issue

Fixes #1424

Motivation and Context

Running the test suite should never open a browser tab. The two unpatched tests broke that expectation and could surprise anyone running tests locally or in CI.

How Has This Been Tested?

uv run pytest tests/cli: 74 passed.

Screenshots (if appropriate):

N/A

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Docs/refactor/test only.

AI Usage Disclosure

  • 🟥 AI-vibecoded: You cannot explain the logic. Car analogy : the car drive by itself, you are outside it and just tell it where to go.
  • 🟠 AI-generated: Car analogy : the car drive by itself, you are inside and give instructions.
  • ⭐ AI-assisted. Car analogy : you drive the car, AI help you find your way.
  • ♻️ No AI used. Car analogy : you drive the car.

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the docs/how-to/contributing.md document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Two authorize() tests in tests/cli/test_cli_auth.py did not patch
webbrowser.open and launched the system browser. An autouse fixture
now stubs it for the whole suite.

Fixes #1424

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@davidberenstein1957
davidberenstein1957 requested a review from a team as a code owner September 23, 2026 07:40
@codecov

codecov Bot commented Sep 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.69%. Comparing base (b64423c) to head (90d7e45).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1425   +/-   ##
=======================================
  Coverage   91.69%   91.69%           
=======================================
  Files          49       49           
  Lines        5152     5152           
=======================================
  Hits         4724     4724           
  Misses        428      428           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@inimaz inimaz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@inimaz
inimaz enabled auto-merge (squash) September 23, 2026 17:03
@inimaz
inimaz merged commit cfabf92 into master Sep 23, 2026
10 checks passed
@inimaz
inimaz deleted the fix/tests-no-browser branch September 23, 2026 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test suite opens a real browser tab

2 participants