feat: Set up complete Python testing infrastructure with Poetry#80
Open
llbbl wants to merge 1 commit intowilliamSYSU:masterfrom
Open
feat: Set up complete Python testing infrastructure with Poetry#80llbbl wants to merge 1 commit intowilliamSYSU:masterfrom
llbbl wants to merge 1 commit intowilliamSYSU:masterfrom
Conversation
- Configure Poetry as package manager with pyproject.toml - Add pytest, pytest-cov, and pytest-mock as dev dependencies - Configure pytest with coverage reporting and custom markers - Create test directory structure with unit/integration subdirs - Add comprehensive shared fixtures in conftest.py - Set up test runner scripts (poetry run test/tests) - Update .gitignore with Claude-specific entries - Create validation tests to verify 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.
Set Up Python Testing Infrastructure
Summary
This PR establishes a complete testing infrastructure for the GAN models project using Poetry as the package manager and pytest as the testing framework. The setup provides a solid foundation for developers to immediately start writing unit and integration tests.
Changes Made
Package Management
pyproject.tomlwith complete Poetry setuprequirements.txtto PoetryTesting Framework
Project Structure
Testing Configuration
test_*.py,*_test.py, ortests.py@pytest.mark.unitfor unit tests@pytest.mark.integrationfor integration tests@pytest.mark.slowfor long-running testsShared Fixtures
Created comprehensive fixtures in
conftest.py:temp_dir: Temporary directory managementmock_config: Mock configuration objectsample_tensor&sample_numpy_array: Test datamock_generator&mock_discriminator: Mock modelsmock_data_loader: Mock data loadingclean_logs: Log directory managementsetup_random_seeds: Reproducible test runsDevelopment Commands
poetry run test: Run all testspoetry run tests: Alternative command (both work)-v,-k,-m)Instructions for Running Tests
Install dependencies:
Run all tests:
poetry run testRun specific test files:
poetry run test tests/test_setup_validation.pyRun tests by marker:
View coverage report:
# After running tests, open the HTML report open htmlcov/index.htmlNotes
.gitignorehas been updated to exclude test artifacts and Claude-specific filesNext Steps
Developers can now:
tests/unit/tests/integration/