feat: Add comprehensive Python testing infrastructure with Poetry#49
Open
llbbl wants to merge 1 commit intotxie-93:masterfrom
Open
feat: Add comprehensive Python testing infrastructure with Poetry#49llbbl wants to merge 1 commit intotxie-93:masterfrom
llbbl wants to merge 1 commit intotxie-93:masterfrom
Conversation
- Set up Poetry for dependency management with pyproject.toml - Add pytest, pytest-cov, and pytest-mock as dev dependencies - Configure pytest with custom markers (unit, integration, slow) - Set up coverage reporting with HTML and XML outputs - Create test directory structure with shared fixtures in conftest.py - Add Poetry script commands for running tests - Update .gitignore with testing and Claude-specific entries - Create validation tests to verify infrastructure setup
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 Python Testing Infrastructure
Summary
This PR sets up a complete testing infrastructure for the CGCNN Python project using Poetry for dependency management and pytest for testing. The infrastructure provides a foundation for writing comprehensive unit and integration tests.
Changes Made
1. Package Management
pyproject.tomlwith Poetry configuration2. Testing Configuration
test_*.pyand*_test.pyfilesunit,integration, andslowcgcnnmodule3. Directory Structure
4. Testing Fixtures
Created comprehensive fixtures in
conftest.py:temp_dir: Temporary directory for test filessample_data_dir: Sample data directory with test filesmock_crystal_data: Mock crystal structure datasample_model_config: Model configuration for testingsample_training_config: Training configurationmock_torch_model: Simple PyTorch model for testingsample_checkpoint: Model checkpoint filecapture_stdout: Stdout capture utilityreset_random_seeds: Reproducible test runsdisable_cuda: CPU-only testingmock_args: Command line argument mocking5. Development Commands
Added Poetry script commands:
poetry run test- Run all testspoetry run tests- Alternative command (both work)6. Additional Setup
.gitignorewith:.pytest_cache/,htmlcov/,coverage.xml).claude/*)Instructions for Running Tests
Install dependencies:
Run all tests:
Run specific test markers:
View coverage report:
htmlcov/index.htmlin a browsercoverage.xmlfor CI integrationNotes
poetry.lockfile is intentionally NOT gitignored to ensure reproducible buildsValidation
The infrastructure has been validated with 9 passing tests that verify:
All validation tests pass successfully, confirming the testing infrastructure is ready for use.