This directory contains a comprehensive test suite for the Resource Manager library using pytest.
The tests are organized into several categories:
-
Unit Tests - Test individual functions, methods, and classes in isolation
test_resources.py- Tests for theResourceandResourceManagerclassestest_links.py- Tests for resource link functionalitytest_resolver.py- Tests for dependency resolution
-
Integration Tests - Test how components work together
test_integration.py- End-to-end workflow tests
-
Property-based Tests - Generate random inputs to find edge cases
test_property_based.py- Tests using Hypothesis for property-based testing
-
Performance Tests - Verify code performs within acceptable limits
test_performance.py- Benchmarks for critical operations
-
Exception Tests - Verify proper error handling
test_exceptions.py- Tests for error cases and exceptions
Install the required dependencies:
pip install -r requirements.txtFrom the project root directory:
python -m pytest resource_manager_testsUnit tests only:
python -m pytest resource_manager_tests -m unitIntegration tests only:
python -m pytest resource_manager_tests -m integrationPerformance benchmarks:
python -m pytest resource_manager_tests -m benchmarkThe test configuration generates coverage reports in several formats:
- Terminal output with missing lines
- HTML report (in
htmlcov/directory) - XML report (in
coverage.xmlfile)
View the HTML report by opening htmlcov/index.html in a web browser.
conftest.py- Common test fixtures and utilitiespytest.ini- Pytest configurationfixtures/- Test data and additional fixtures
When adding new tests:
- Follow the naming convention:
test_*.pyfor files andtest_*for functions - Use appropriate markers for test categorization
- Leverage existing fixtures from
conftest.pywhere possible - Maintain high test coverage (aim for 80%+)