|
| 1 | +# Running Tests |
| 2 | + |
| 3 | +## Quick Start (Using Make) |
| 4 | + |
| 5 | +The easiest way to run tests: |
| 6 | + |
| 7 | +```bash |
| 8 | +# First time setup - create virtual environment |
| 9 | +make venv |
| 10 | +source .venv/bin/activate |
| 11 | + |
| 12 | +# Install dependencies |
| 13 | +make install |
| 14 | + |
| 15 | +# Run all tests |
| 16 | +make test |
| 17 | + |
| 18 | +# Run just the catalog vendor tests |
| 19 | +make test-vendor |
| 20 | + |
| 21 | +# Run tests with coverage |
| 22 | +make test-cov |
| 23 | +``` |
| 24 | + |
| 25 | +## Manual Test Commands |
| 26 | + |
| 27 | +If you prefer to run pytest directly: |
| 28 | + |
| 29 | +```bash |
| 30 | +# Activate virtual environment |
| 31 | +source .venv/bin/activate |
| 32 | + |
| 33 | +# Run catalog extra fields tests |
| 34 | +python -m pytest tests/test_vendor/test_catalog_v1.py -v |
| 35 | +``` |
| 36 | + |
| 37 | +## All Test Commands |
| 38 | + |
| 39 | +```bash |
| 40 | +# Run all catalog vendor tests |
| 41 | +python -m pytest tests/test_vendor/ -v |
| 42 | + |
| 43 | +# Run specific test file |
| 44 | +python -m pytest tests/test_vendor/test_catalog_v1.py -v |
| 45 | + |
| 46 | +# Run specific test class |
| 47 | +python -m pytest tests/test_vendor/test_catalog_v1.py::TestMetadataExtraFields -v |
| 48 | + |
| 49 | +# Run specific test method |
| 50 | +python -m pytest tests/test_vendor/test_catalog_v1.py::TestMetadataExtraFields::test_metadata_accepts_extra_fields -v |
| 51 | + |
| 52 | +# Run with more verbose output |
| 53 | +python -m pytest tests/test_vendor/test_catalog_v1.py -vv |
| 54 | + |
| 55 | +# Run and show print statements |
| 56 | +python -m pytest tests/test_vendor/test_catalog_v1.py -v -s |
| 57 | + |
| 58 | +# Run all tests in the project |
| 59 | +python -m pytest tests/ -v |
| 60 | +``` |
| 61 | + |
| 62 | +## Using tox (Recommended for full test suite) |
| 63 | + |
| 64 | +The GitHub Actions CI uses tox to run tests across multiple Python and Pydantic versions: |
| 65 | + |
| 66 | +```bash |
| 67 | +# Run tests with Python 3.10 and Pydantic 2.10 (no coverage) |
| 68 | +python3 -m tox -e py310-pydantic210-nocov |
| 69 | + |
| 70 | +# Run tests with coverage |
| 71 | +python3 -m tox -e py310-pydantic210-cover |
| 72 | + |
| 73 | +# Run specific tests with tox |
| 74 | +python3 -m tox -e py310-pydantic210-nocov -- tests/test_vendor/test_catalog_v1.py |
| 75 | +``` |
| 76 | + |
| 77 | +## Continuous Integration |
| 78 | + |
| 79 | +Tests run automatically on every push and pull request via GitHub Actions (`.github/workflows/github-actions.yml`). |
| 80 | + |
| 81 | +The CI runs tests across: |
| 82 | +- Python versions: 3.10, 3.11, 3.12, PyPy 3.10 |
| 83 | +- Pydantic versions: 2.8, 2.10 |
| 84 | +- With and without coverage reports |
0 commit comments