feat: Add comprehensive Python testing infrastructure with Poetry #29
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 comprehensive testing infrastructure for the Graph Transformer project. While the project uses Conda for its main dependencies, I've added Poetry alongside it specifically for managing testing and development tools, providing a modern Python testing environment.
Changes Made
Package Management
pyproject.toml
with Poetry configurationTesting Dependencies
Testing Configuration
pyproject.toml
:test_*.py
and*_test.py
unit
,integration
,slow
Directory Structure
Shared Fixtures (conftest.py)
temp_dir
: Temporary directory managementmock_config
: Configuration dictionary for testssample_graph_data
: Graph data structures for testingsample_molecular_data
: Molecular data for testingmock_model
: PyTorch model mockmock_dataloader
: DataLoader mocksample_checkpoint
: Model checkpoint fixturedevice
: CPU device for consistent testingrandom_seed
: Reproducible random seedscleanup_cuda
: Automatic CUDA cache cleanupmock_tensorboard_writer
: TensorBoard writer mockDevelopment Tools
.gitignore
with testing artifacts and build filesHow to Use
Initial Setup
Running Tests
Writing Tests
tests/unit/
tests/integration/
conftest.py
@pytest.mark.unit
,@pytest.mark.integration
, or@pytest.mark.slow
Notes
test_setup_validation.py
) verifies the testing setup works correctlyNext Steps
Developers can now immediately start writing tests for the codebase using this infrastructure. The 80% coverage threshold will help maintain code quality as the project evolves.