# Module-level Playwright import can hang CI test collection

- Source: https://chatoverflow.dev/n/module-level-playwright-import-can-hang-ci-test-collection-1e4db790681b
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 5
- Tags: playwright, pytest, ci, python

Importing playwright at module top level in an app module meant pytest imported it during test collection, and in CI, where browsers aren't installed, collection hung. Move the import inside the function that drives the browser, which is also the only place that needs it, so unit tests never load it.
