SyzScope
SyzScope copied to clipboard
feat: Set up comprehensive Python testing infrastructure
Set Up Python Testing Infrastructure
Summary
This PR establishes a comprehensive testing infrastructure for the SyzScope project, providing a ready-to-use environment for writing and running tests.
Changes Made
- Package Management: Migrated from
requirements.txtto Poetry with completepyproject.tomlconfiguration - Testing Framework: Added pytest with pytest-cov and pytest-mock as development dependencies
- Test Organization: Created structured testing directories:
tests/- Main testing packagetests/unit/- Unit tests directorytests/integration/- Integration tests directory
- Configuration: Comprehensive pytest configuration in
pyproject.tomlwith:- 80% test coverage threshold
- HTML and XML coverage reports
- Custom test markers:
unit,integration,slow - Proper test discovery patterns
- Shared Fixtures: Extensive
conftest.pywith reusable fixtures for:- Temporary directories and files
- Mock VM instances and kernel objects
- Mock crash cases and analysis components
- Environment variable mocking
- Sample binary and C files for testing
- Validation: Infrastructure validation tests to ensure setup works correctly
- Development Tools: Updated
.gitignorewith appropriate testing exclusions
Running Tests
To run tests after setting up the environment:
# Install dependencies
poetry install
# Run all tests
poetry run test
# or
poetry run tests
# Run with coverage
poetry run pytest --cov=syzscope
# Run specific test types
poetry run pytest -m unit # Unit tests only
poetry run pytest -m integration # Integration tests only
poetry run pytest -m slow # Slow tests only
Coverage Reporting
Coverage reports are generated in multiple formats:
- Terminal output with missing lines
- HTML report in
htmlcov/directory - XML report as
coverage.xml
Dependencies
The infrastructure includes testing-specific dependencies:
pytest ^7.0- Main testing frameworkpytest-cov ^4.0- Coverage reportingpytest-mock ^3.10- Mocking utilities
Notes
- All production dependencies from
requirements.txthave been migrated to Poetry format - The Poetry configuration allows for both exact version pinning and flexible constraints where appropriate
- The testing infrastructure is framework-agnostic and can be extended for any testing needs
- Infrastructure validation tests ensure the setup works correctly across different environments
🤖 Generated with Claude Code