pytest-pw-config-gen
Generate pytest-playwright configuration files (pytest.ini, pyproject.toml, conftest.py) via CLI.
Installation
pip install pytest-pw-config-gen
Quick Mode
Generate a configuration file immediately with sensible defaults — no prompts required.
pytest-pw-config-gen --quick --output pytest.ini
pytest-pw-config-gen --quick --output pyproject.toml
pytest-pw-config-gen --quick --output conftest.py
Pass --force to overwrite an existing file without confirmation:
pytest-pw-config-gen --quick --output pytest.ini --force
Interactive Mode
The full-screen terminal wizard is the default when no flags are provided. Pass --interactive explicitly if needed:
pytest-pw-config-gen
# or
pytest-pw-config-gen --interactive
It opens a keyboard-driven form:
| Key | Action |
|---|---|
↑ / ↓ |
Move between options |
Space / Enter |
Toggle a boolean / open a selection menu / edit a value |
Ctrl+G |
Confirm and proceed to save |
q / Esc |
Cancel |
After pressing Ctrl+G you are prompted for an output path (defaulting to the current directory). If the file already exists you are asked to confirm the overwrite before anything is written.
In CI environments without a TTY the tool prints a clear error message and exits non-zero rather than hanging.
Supported Options
pytest.ini / pyproject.toml options
| Option | Description | Default |
|---|---|---|
| browsers | One or more browsers: chromium, firefox, webkit (multi-select) |
chromium |
| headed | Run browser in headed mode (visible window) | false |
| browser channel | Chromium channel: chrome, chrome-beta, chrome-dev, msedge |
(none) |
| device preset | Emulate a named device (e.g. iPhone 13) |
(none) |
| tracing | Playwright tracing mode: off, on, retain-on-failure |
off |
| video | Video capture mode: off, on, retain-on-failure |
off |
| screenshot | Screenshot capture mode: off, on, only-on-failure |
off |
| artifact output dir | Directory where traces, videos, and screenshots are saved | (none) |
| base-url | Base URL for page.goto() relative URLs |
(none) |
| slow-motion | Delay between Playwright actions in milliseconds | 0 |
| workers | Parallel worker count via -n flag (requires pytest-xdist) |
(none) |
| retries | Number of test reruns on failure (requires pytest-rerunfailures) | 0 |
| reporter | Test report format: html, junit, json |
(none) |
| timeout | Per-test timeout in seconds (requires pytest-timeout) | 30 |
| testpaths | Directories pytest searches for tests | tests |
| markers | Custom pytest marker definitions | (none) |
conftest.py options
| Option | Description | Default |
|---|---|---|
| viewport | Browser window size as width × height | 1280 × 720 |
| action timeout | Per-action timeout in milliseconds | (none) |
| locale | Browser locale (e.g. en-US, fr-FR) |
(none) |
| timezone_id | IANA timezone for the browser context (e.g. America/New_York) |
(none) |
| geolocation | Latitude and longitude for the browser context | (none) |
| storage_state | Path to a previously saved browser storage state file | (none) |
| color_scheme | Preferred color scheme: light, dark, or no-preference |
(none) |
| accept_downloads | Automatically accept file downloads | false |
| permissions | Browser permissions to grant (e.g. geolocation, notifications) |
(none) |
| http_credentials | Username and password for HTTP Basic/Digest authentication | (none) |
| extra_http_headers | Additional HTTP headers sent with every request | (none) |
| user_agent | Custom User-Agent string | (none) |
| ignore_https_errors | Ignore HTTPS certificate errors | false |
Output Files
All generated files include a comment header identifying them as auto-generated and inline comments explaining non-obvious options so you know what to adjust after generation.
pytest.ini
Sets [pytest] addopts flags (browser, tracing, video, etc.) and common ini options (testpaths, timeout, markers).
pyproject.toml
Sets [tool.pytest.ini_options] with the same options — suitable when you prefer a single pyproject.toml for all project tooling.
conftest.py
Creates a browser_context_args fixture with Playwright context options (viewport, locale, geolocation, storage state, etc.). Drop this file in your test root alongside the chosen pytest.ini or pyproject.toml.
Requirements
- Python 3.9+
- pytest-playwright (installed separately in your test project)
License
MIT
Release files for pytest-pw-config-gen 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pytest_pw_config_gen-0.1.0.tar.gz | 24.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_pw_config_gen-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 43.4 kB
Release files / pytest_pw_config_gen-0.1.0.tar.gz
| Download URL | pytest_pw_config_gen-0.1.0.tar.gz |
|---|---|
| Size | 24.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
602c6dc29aa38cac8d3fb351841c3c3aac4ef016739ec1a63576cc414eec9283
|
|
BLAKE2b-256 checksum How to use checksums |
7037f108992c594dcc48c57e23104803c50308860a4a4638e9081bf7317202a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 14, 2026.
Transparency logRelease files / pytest_pw_config_gen-0.1.0-py3-none-any.whl
| Download URL | pytest_pw_config_gen-0.1.0-py3-none-any.whl |
|---|---|
| Size | 19.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
41891eada6df03dd8640420c35a5730f6b7d7c429b284907da97e12a6c8c3058
|
|
BLAKE2b-256 checksum How to use checksums |
30f3d082ddc72f65d578e26df5ce31097faa79e0fe52e4c864252174ce7f55c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 14, 2026.
Transparency log