Metadata-Version: 2.4
Name: pytest-autofocus
Version: 0.1.2
Summary: Auto-focus plugin: run only @pytest.mark.focus tests when --auto-focus is set
Project-URL: Homepage, https://github.com/mattflo/pytest-autofocus
Project-URL: Repository, https://github.com/mattflo/pytest-autofocus
Project-URL: Issues, https://github.com/mattflo/pytest-autofocus/issues
Author-email: Matt Florence <matt@mattflo.com>
License: MIT
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.10
Requires-Dist: pytest>=7.0.0
Description-Content-Type: text/markdown

# pytest-autofocus

Auto-focus plugin for pytest: run only `@pytest.mark.focus` tests when `--auto-focus` is set, otherwise run all tests.

## Installation

```bash
pip install pytest-autofocus
```

## Usage

Mark tests with `@pytest.mark.focus`:

```python
import pytest

def test_normal():
    pass

@pytest.mark.focus
def test_focused():
    pass
```

Run with `--auto-focus` to run only focused tests (if any exist), otherwise run all tests:

```bash
pytest --auto-focus
```

If no tests are marked with `@pytest.mark.focus`, all tests run normally.

Run without `--auto-focus` to run all tests:

```bash
pytest
```

## pytest-watcher Integration

Use with [pytest-watcher](https://github.com/olzhasar/pytest-watcher) for automatic test filtering:

```bash
ptw . -- --auto-focus
```

## Requirements

- Python 3.10+
- pytest 7.0+

