feat: Set up comprehensive Python testing infrastructure#5
Open
llbbl wants to merge 1 commit intoOpenDFM:mainfrom
Open
feat: Set up comprehensive Python testing infrastructure#5llbbl wants to merge 1 commit intoOpenDFM:mainfrom
llbbl wants to merge 1 commit intoOpenDFM:mainfrom
Conversation
- Configure Poetry as package manager with pyproject.toml - Add pytest, pytest-cov, and pytest-mock as test dependencies - Create testing directory structure (tests/unit/, tests/integration/) - Configure pytest with custom markers (unit, integration, slow) - Set up coverage reporting with 80% threshold and HTML/XML output - Add comprehensive shared fixtures in conftest.py - Create validation tests to verify testing infrastructure - Update .gitignore with testing and development entries - Install dependencies and validate test execution
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.
Set up comprehensive Python testing infrastructure
Summary
This PR establishes a complete testing infrastructure for the ChemDFM project using Poetry as the package manager and pytest as the testing framework. The setup provides a ready-to-use testing environment where developers can immediately start writing tests.
Changes Made
Package Management
pyproject.tomlwith Poetry configurationTesting Framework
unit,integration, andslowtest markers for test categorizationTest Fixtures and Utilities
conftest.pywith reusable fixtures:temp_dir: Temporary directory for test filesmock_tokenizer,mock_model: Mock ML model componentssample_args: Mock configuration objectscapture_stdout,mock_input: Testing utilitiesclean_environment: Environment isolationCoverage Configuration
chemdfmpackage coverageDevelopment Environment
.gitignore: Comprehensive gitignore covering:.pytest_cache/,htmlcov/,.coverage)__pycache__/,*.pyc,dist/).claude/*)Testing Instructions
Running Tests
Coverage Reports
htmlcov/index.htmlfor detailed coverage analysiscoverage.xmlfor CI/CD integrationTest Organization
tests/unit/for isolated component testingtests/integration/for end-to-end testingtests/conftest.pyValidation
✅ All validation tests pass
✅ Poetry dependency installation successful
✅ pytest configuration working correctly
✅ Custom markers functional
✅ Coverage reporting configured
✅ Fixtures and utilities available
Next Steps
The testing infrastructure is now ready for development:
conftest.pyas neededDependencies Added
Production Dependencies
torch ^2.0.0: PyTorch for ML functionalitytransformers ^4.30.0: Hugging Face transformers libraryTest Dependencies
pytest ^7.4.0: Main testing frameworkpytest-cov ^4.1.0: Coverage reportingpytest-mock ^3.11.0: Advanced mocking capabilitiesThis setup follows Python testing best practices and provides a solid foundation for maintaining high code quality through comprehensive testing.