feat: Set up comprehensive Python testing infrastructure#7
Open
llbbl wants to merge 1 commit into
Open
Conversation
- Configure Poetry as package manager with pyproject.toml - Migrate dependencies from envs/requirements.txt - Add pytest, pytest-cov, pytest-mock as development dependencies - Create testing directory structure (tests/, unit/, integration/) - Configure pytest with coverage reporting (80% threshold) - Add custom test markers (unit, integration, slow) - Create comprehensive shared fixtures in conftest.py - Set up poetry scripts for running tests (test/tests commands) - Update .gitignore with testing-related entries - Add infrastructure 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 RealCustom project, providing developers with a ready-to-use testing environment for writing and running tests.
Changes Made
Package Management
pyproject.tomlwith Poetry as the package managerenvs/requirements.txtto Poetry formatpytest ^7.0.0(main testing framework)pytest-cov ^4.0.0(coverage reporting)pytest-mock ^3.10.0(mocking utilities)Testing Configuration
pyproject.tomlunit,integration,slowmodels/,inference/, andschedulers/directoriesDirectory Structure
Shared Fixtures & Utilities
Created comprehensive fixtures in
conftest.py:temp_dir,temp_file,cleanup_filessample_config,mock_config_filesample_tensor,sample_image_batch,sample_text_promptsmock_model,mock_optimizer,mock_scheduler,mock_tokenizermock_torch_device,mock_huggingface_model,mock_gradio_interfaceset_random_seeds,mock_loggerDevelopment Commands
poetry run test- Run all testspoetry run tests- Alternative test command-v,-k,-m,--cov, etc.Infrastructure Validation
test_infrastructure.pywith 14 tests covering:Configuration Updates
.gitignore: Added.claude/directory for Claude Code settingsInstructions for Running Tests
Basic Usage
Coverage Reports
Coverage reports will be generated in:
--cov-report=term-missinghtmlcov/index.html(with--cov-report=html)coverage.xml(with--cov-report=xml)Writing Tests
tests/unit/tests/integration/conftest.pyor create test-specific ones@pytest.mark.unit,@pytest.mark.integration, or@pytest.mark.slowValidation Results
All infrastructure validation tests pass:
Next Steps
Developers can now:
conftest.pyfor specific testing needsThe testing infrastructure is ready for immediate use and provides a solid foundation for maintaining code quality in the RealCustom project.