feat: Set up comprehensive Python testing infrastructure with Poetry#24
Open
llbbl wants to merge 1 commit intogenforce:masterfrom
Open
feat: Set up comprehensive Python testing infrastructure with Poetry#24llbbl wants to merge 1 commit intogenforce:masterfrom
llbbl wants to merge 1 commit intogenforce:masterfrom
Conversation
- Added Poetry configuration with testing dependencies (pytest, pytest-cov, pytest-mock) - Created test directory structure with unit/integration subdirectories - Configured pytest with coverage reporting, custom markers, and test discovery - Added comprehensive test fixtures in conftest.py for common testing scenarios - Created validation tests to ensure testing infrastructure works correctly - Updated .gitignore with testing artifacts and Claude settings - Configured test commands accessible via `poetry run test` or `poetry run tests`
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 comprehensive testing infrastructure for the SeFa (Closed-Form Factorization of Latent Semantics in GANs) Python project. The setup provides a solid foundation for writing and maintaining tests, with Poetry for dependency management, pytest for testing, and coverage reporting.
Changes Made
Package Management
pyproject.tomlwith Poetry configuration as the package managerTesting Infrastructure
Configuration
pytest Configuration in
pyproject.toml:test_*.pyand*_test.pyfiles@pytest.mark.unit,@pytest.mark.integration,@pytest.mark.slowCoverage Settings:
Test Fixtures (conftest.py)
temp_dir: Temporary directory for test filesmock_model_config: Mock configuration for model testingsample_latent_codes: Sample PyTorch tensors for latent code testingsample_numpy_array: Sample numpy arrays for data testingmock_generator_output: Mock generator model outputsdevice: PyTorch device fixture (CPU by default)test_data_dir: Temporary data directory with test filesreset_torch_seed: Auto-fixture to ensure reproducible testsmock_streamlit_session: Mock Streamlit session statecapture_stdout: Stdout capture for testing print statementsOther Updates
.pytest_cache/,.coverage,htmlcov/,coverage.xml.claude/*poetry.lockis intentionally NOT ignoredRunning Tests
After pulling this branch, install dependencies and run tests:
Validation
The setup includes validation tests (
test_setup_validation.py) that verify:All 20 validation tests pass successfully.
Next Steps
With this infrastructure in place, developers can now:
tests/unit/tests/integration/Notes