SuperAPI AI Directory

pytest

Testing & quality

View repository

Updated 10-15 21:48

About this skill

When to use this skill

Use this skill whenever the user wants to:

  • Write or run Python unit tests and fixtures with pytest
  • Use assertions, parametrization, mocks, and plugins (coverage, parallel)

How to use this skill

  1. Test cases: test_ prefix or Test classes; assert statements; @pytest.fixture, conftest.py.
  2. Running: pytest, pytest -v -k "pattern", pytest --cov; markers and xfail.
  3. Plugins: pytest-cov, pytest-xdist, pytest-mock; pytest.ini or pyproject.toml configuration.

Best Practices

  • Unit tests are independent and have no side effects; use fixtures to prepare data and dependencies.
  • Clear naming and directory structure; avoid dependence on execution order.
  • Run the full suite in CI; coverage and stop on failure.

Keywords

pytest, Python testing, fixture, unit test