Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions tests/README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,47 @@
# Python Tests

based on pytest.
Tests are managed via [Hatch](https://hatch.pypa.io/) and run with pytest.

## Running Tests

Make sure to install test dependencies: `pip install -r requirements-test.txt`.

### All Tests

```bash
pytest
hatch test
```

### Target a specific Python version

```bash
hatch test --python 3.11
hatch test --python 3.13
```

### Specific Test File

```bash
pytest tests/test_yaml_parser.py -v
hatch test -- tests/test_yaml_parser.py -v
```

### Specific Test Class

```bash
pytest tests/test_yaml_parser.py::TestYamlParser -v
hatch test -- tests/test_yaml_parser.py::TestYamlParser -v
```

### Specific Test Function

```bash
hatch test -- tests/test_yaml_parser.py::TestYamlParser::test_yaml_parser_basic_functionality -v
```

### Full CI invocation

```bash
pytest tests/test_yaml_parser.py::TestYamlParser::test_yaml_parser_basic_functionality -v
hatch fmt --linter --check
hatch test --python 3.11 --cover --randomize --parallel --retries 2 --retry-delay 1
```

## Test Configuration

See `pytest.ini` in the root directory.
See `[tool.hatch]` and `[tool.coverage]` sections in `pyproject.toml`.
Loading