Metadata-Version: 2.4
Name: plain.pytest
Version: 0.9.0
Summary: Pytest integration for Plain.
Author-email: Dave Gaeddert <dave.gaeddert@dropseed.dev>
License-Expression: BSD-3-Clause
License-File: LICENSE
Requires-Python: >=3.11
Requires-Dist: click>=8.0.0
Requires-Dist: cryptography
Requires-Dist: plain<1.0.0
Requires-Dist: pytest>=7.0.0
Requires-Dist: python-dotenv~=1.0.0
Description-Content-Type: text/markdown

# plain.pytest

**Test with pytest.**

Use the `plain test` command to run tests with pytest and automatically load a `.env.test` (if available).

## Fixtures

### `settings`

Use the `settings` fixture to access and modify settings during tests.

```python
def test_example(settings):
    settings.DEBUG = True
    assert settings.DEBUG is True
```

### `testbrowser`

A lightweight wrapper around [Playwright](https://playwright.dev/python/) that starts a gunicorn side-process to point the browser at.

Note that `playwright`, `pytest-playwright`, and `gunicorn` are not dependencies of this package but are required if you want to use this fixture.

```python
def test_example(testbrowser):
    page = testbrowser.new_page()
    page.goto('/')
    assert page.title() == 'Home Page'
```

If `plain.models` is installed, then the `testbrowser` will also load the [`isolated_db`](/plain-models/plain/models/test/pytest.py#isolated_db) fixture and pass a `DATABASE_URL` to the gunicorn process.
