feat: Set up complete Python testing infrastructure with Poetry #80
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/