Skip to content

fix(ci): prevent pytest-playwright import crash in unit tests#212

Merged
cpsievert merged 6 commits intomainfrom
fix/pytest-playwright-import
Mar 5, 2026
Merged

fix(ci): prevent pytest-playwright import crash in unit tests#212
cpsievert merged 6 commits intomainfrom
fix/pytest-playwright-import

Conversation

@cpsievert
Copy link
Contributor

@cpsievert cpsievert commented Mar 4, 2026

Summary

  • Add -p no:playwright to the py-check-tests Make target so pytest doesn't auto-load the pytest-playwright plugin (which crashes importing playwright.sync_api) when running unit tests
  • Add Makefile to the py-test.yml workflow path triggers so Makefile changes trigger CI
  • Disable pull_request trigger on E2E workflow — the OPENAI_API_KEY from the pypi environment is not available to PR-triggered runs, causing every LLM-dependent test to silently timeout. E2E tests still run on push to main/rc-* and via workflow_dispatch.

Test plan

  • Test - Python CI workflow passes across all Python versions (3.10-3.14)
  • No more ModuleNotFoundError: No module named 'playwright.sync_api'
  • E2E workflow no longer triggers on PRs (avoiding 30-min timeout failures)
  • E2E tests still pass on main via workflow_dispatch (verified manually)

🤖 Generated with Claude Code

The pytest-playwright plugin auto-loads at startup and imports
playwright.sync_api, which fails when the sync_api module isn't
available. Add `-p no:playwright` to the non-playwright test run.

Also rename the E2E workflow environment from "pypi" to "testing"
to stop generating misleading "deploying to pypi" notifications on PRs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The Makefile contains the pytest commands, so changes to it should
trigger both the unit test and E2E test workflows.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The E2E make target wasn't changed, so there's no need to trigger
the E2E workflow on Makefile changes. This avoids unnecessary flaky
E2E runs on CI-only PRs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
cpsievert and others added 3 commits March 4, 2026 14:49
The OPENAI_API_KEY secret is configured in the "pypi" environment.
Changing it to "testing" broke all LLM-dependent E2E tests because
the secret wasn't available in the new environment.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The E2E tests require OPENAI_API_KEY from the pypi environment, which
GitHub does not provide to pull_request-triggered workflows. This caused
every LLM-dependent test to silently fail (60s timeout per test × 3
attempts), making the job hit its 30-minute timeout.

E2E tests still run on push to main/rc-* and via workflow_dispatch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
OPENAI_API_KEY is now a repository-level secret (not just an
environment secret), so it's available to pull_request-triggered
workflows. Remove the pypi environment requirement and restore
the pull_request trigger.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cpsievert cpsievert merged commit 0cc65db into main Mar 5, 2026
6 checks passed
@cpsievert cpsievert deleted the fix/pytest-playwright-import branch March 5, 2026 23:40
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.

1 participant