skillfed

Pytest

Pytest is Python's industry-standard testing framework, built to handle the rigorous demands of customer support systems. This skill covers fixtures, parametrization, mocking, async operations, and database testing with PostgreSQL and SQLAlchemy—everything needed to test ticketing platforms, APIs, and multi-tenant architectures reliably.

Pytest helps you run and execute Python unit tests with fixtures, mocking, and async support for customer support systems.

AI-generated summary based on this skill's SKILL.md

61 15 unlicensed — metadata only updated by manutej

Install

manutej/luxor-claude-marketplace/pytest · repository language: Shell

git clone https://github.com/manutej/luxor-claude-marketplace
cp -r luxor-claude-marketplace ~/.claude/skills/pytest

generated, unverified - the skill's exact subdirectory could not be determined; check the repository on GitHub

npx skillfed install manutej/luxor-claude-marketplace/pytest

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

How do I run pytest for Python unit testing?

Pytest executes Python unit tests by discovering test files (test_*.py or *_test.py) in your project and running all test functions. Use `pytest` to run all tests, `pytest path/to/test.py` for specific files, or `pytest -k pattern` to filter by test name. Pytest's straightforward command-line interface makes it the industry standard for Python testing, especially in customer support systems where reliability is critical.

What are pytest fixtures and how do I use them?

Pytest fixtures are reusable test components defined with the @pytest.fixture decorator that provide setup and teardown logic. Fixtures handle database connections, mock objects, and test data initialization—essential for testing ticketing platforms and APIs. Pass fixture names as function parameters to inject them into tests. This approach eliminates boilerplate and ensures consistent test environments across your test suite.

How do I configure pytest markers and test discovery?

Pytest discovers tests automatically in files matching test_*.py or *_test.py patterns. Configure markers in pytest.ini or pyproject.toml to categorize tests (e.g., @pytest.mark.slow, @pytest.mark.integration). Use `pytest -m marker_name` to run specific test groups. This setup is vital for multi-tenant architectures where you need to separate unit tests, integration tests, and performance tests efficiently.

How can I generate test coverage reports with pytest?

Pytest generates coverage reports using the pytest-cov plugin. Install it with `pip install pytest-cov`, then run `pytest --cov=your_module --cov-report=html` to create an HTML coverage report. This shows which lines of code are tested, helping you identify gaps in test coverage for critical components like APIs and database operations in support systems.

What pytest command line options help debug failing tests?

Pytest offers several debugging options: `pytest -v` for verbose output, `pytest -s` to show print statements, `pytest --tb=short` for concise tracebacks, and `pytest --pdb` to drop into the debugger on failures. Use `pytest --lf` to rerun last failed tests or `pytest --ff` to run failed tests first. These tools help troubleshoot issues in ticketing platforms and complex test scenarios quickly.

How do I extend pytest with plugins and custom configurations?

Pytest extends through plugins installed via pip (e.g., pytest-asyncio for async testing, pytest-mock for mocking). Create a conftest.py file in your project root to define shared fixtures and custom hooks. Configure pytest behavior in pytest.ini, setup.cfg, or pyproject.toml. This flexibility lets you tailor Pytest to your specific needs—whether testing PostgreSQL databases, SQLAlchemy models, or multi-tenant architectures.

Related skills

Tags

test-automation python-testing unit-testing-framework test-fixtures ci-cd-testing code-quality test-coverage developer-tools