Skip to content

Installation

๐Ÿค– AI-Generated Content

This documentation was generated with AI assistance and is still being audited. Some, or potentially a lot, of this information may be inaccurate. Learn more.

Prerequisites

Additional Requirements: - pytest 7.0 or later - Required for running tests

Installing UV

Python Version Setup

Virtual Environment

Installing Provide TestKit

uv add provide-testkit

Using pip

pip install provide-testkit

From Source

For development or the latest features:

# Clone the repository
git clone https://github.com/provide-io/provide-testkit.git
cd provide-testkit

# Set up environment and install
uv sync

# Verify installation
python -c "import provide.testkit; print('โœ… TestKit installed')"

Optional Dependencies

Provide TestKit offers several optional feature sets:

Quality Tools

Install all code quality analysis tools:

pip install provide-testkit[quality]

Includes: - Code coverage (coverage.py) - Security scanning (bandit) - Complexity analysis (radon) - Documentation coverage (interrogate) - Performance profiling (memray)

Specific Tool Sets

Install only the tools you need:

# Coverage and security only
pip install provide-testkit[coverage,security]

# All complexity tools
pip install provide-testkit[complexity]

All Features

Install everything:

pip install provide-testkit[all]

Verify Installation

Confirm Provide TestKit is installed correctly:

import provide.testkit
print(provide.testkit.__version__)

In your tests:

from provide.testkit import fixtures

def test_installation(fixtures.temp_directory):
    """Test that fixtures work."""
    assert fixtures.temp_directory.exists()

Troubleshooting

TestKit-Specific Issues

Problem: Fixtures not discovered by pytest

Solution: Ensure pytest is configured to find provide.testkit:

# Check if testkit is installed
python -c "import provide.testkit; print('โœ… Found')"

# Run pytest with verbose fixture discovery
pytest --fixtures | grep provide

Problem: setproctitle warnings on macOS

Solution: This is normal - testkit blocks setproctitle to prevent macOS terminal freezing with pytest-xdist. The blocker is working correctly.

Next Steps