feat: Set up comprehensive Python testing infrastructure with Poetry#341
Open
llbbl wants to merge 1 commit intotensorflow:masterfrom
Open
feat: Set up comprehensive Python testing infrastructure with Poetry#341llbbl wants to merge 1 commit intotensorflow:masterfrom
llbbl wants to merge 1 commit intotensorflow:masterfrom
Conversation
- Migrate from setup.py to Poetry package manager in pyproject.toml - Add pytest, pytest-cov, and pytest-mock as dev dependencies - Configure pytest with custom markers (unit, integration, slow) - Set up coverage reporting with 80% threshold and multiple formats - Create tests/ directory structure with unit/ and integration/ subdirs - Add comprehensive shared fixtures in conftest.py - Update .gitignore with testing and development artifacts - Create validation tests to verify infrastructure setup - Configure Poetry scripts for 'test' and 'tests' commands - Document testing setup and known ARM64 compatibility issues
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
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.
Add Comprehensive Python Testing Infrastructure
Summary
This PR sets up a complete testing infrastructure for the TensorFlow Transform project, migrating from the legacy setup.py to modern Poetry package management and adding pytest as the primary testing framework.
Changes Made
Package Management Migration
pyproject.tomlwith Poetry configurationsetup.pyto Poetry formatTesting Framework Setup
Testing Configuration
Created comprehensive pytest configuration in
pyproject.toml:test_*.pyand*_test.pyfilesunit- Fast, isolated unit testsintegration- Tests requiring external resourcesslow- Long-running testsDirectory Structure
Shared Testing Fixtures
Created comprehensive fixtures in
conftest.py:temp_dir- Temporary directory managementtemp_file- Temporary file handlingmock_config- Sample configuration datasample_data- Test data for transformationstf_example_data- TFRecord test data generationmock_preprocessing_fn- Sample preprocessing functionmock_schema- TensorFlow metadata schema fixtureDevelopment Workflow
Configured Poetry scripts for consistent test execution:
Both commands support all standard pytest options:
Documentation
.gitignorewith testing artifacts and development filestests/README.mdwith:Testing the Setup
Validation tests have been created and verified:
Known Issues
ARM64 Architecture Support
Some dependencies (particularly
tfx-bsl) may not have pre-built wheels for ARM64 architectures. This affects:Workarounds are documented in
tests/README.md.Next Steps
With this infrastructure in place, developers can now:
tests/unit/directorytests/integration/directoryThe testing infrastructure is ready for immediate use - developers can start writing tests using the established patterns and fixtures.