feat: Add comprehensive Python testing infrastructure#24
Open
llbbl wants to merge 1 commit into
Open
Conversation
- Set up Poetry package manager with pyproject.toml configuration - Add pytest, pytest-cov, and pytest-mock as test dependencies - Configure pytest with coverage reporting (80% threshold, HTML/XML output) - Create structured test directories (tests/, unit/, integration/) - Add comprehensive conftest.py with shared fixtures for mocking - Update .gitignore with testing and coverage exclusions - Add validation tests to verify infrastructure setup - Configure custom pytest markers (unit, integration, slow) - Migrate existing dependencies from chainbreaker requirements.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Complete Python Testing Infrastructure
Summary
This PR establishes a comprehensive testing infrastructure for the Apfell project, providing developers with all the necessary tools and configurations to write and run tests effectively.
Changes Made
pyproject.tomlconfigurationpytest(main testing framework)pytest-cov(coverage reporting)pytest-mock(mocking utilities)tests/(main test directory)tests/unit/(unit tests)tests/integration/(integration tests)__init__.pyfilespyproject.toml:unit,integration,slow)tests/conftest.pywith reusable fixtures:.gitignorewith testing-related exclusionsTesting Infrastructure Features
Running Tests
Coverage Reporting
htmlcov/directorycoverage.xmlAvailable Fixtures
The
conftest.pyprovides comprehensive fixtures for testing:temp_dir: Temporary directory managementsample_config: Standard configuration dictionarymock_agent,mock_task,mock_callback: Mock Mythic objectsmock_file_system: File system testing utilitiesmock_environment_vars: Environment variable setupCustom Markers
@pytest.mark.unit: Mark unit tests@pytest.mark.integration: Mark integration tests@pytest.mark.slow: Mark slow-running testsValidation
The infrastructure has been validated with comprehensive tests in
test_infrastructure_validation.pythat verify:Next Steps
Developers can now:
poetry installtests/unit/ortests/integration/poetry run pytesthtmlcov/index.htmlConfiguration Notes
This infrastructure provides a solid foundation for comprehensive testing of the Apfell payload system.