Python Connector Tests
The Python connector uses pytest for testing, including both unit tests and doctests.Running All Python Tests
The simplest way to run all Python tests is using the provided test script:- Unit tests in the
delta_sharingpackage - Doctests embedded in the module documentation
- Integration tests with verbose output and colored results
The test script automatically ignores
delta_sharing/_yarl_patch.py during automatic import to verify it’s loaded on-demand as expected.Running Specific Test Files
To run tests from a specific file:Running Specific Test Cases
Target individual test functions or classes:Python Test Options
Customize test execution with pytest options:Python Test Environment
Tests can use environment variables for configuration:AWS_ACCESS_KEY_ID is set, the test script enables verbose logging (-o log_cli=true -s).
Spark Connector and Server Tests
The Spark connector and Delta Sharing Server use ScalaTest via SBT.Running All Scala Tests
Run the complete test suite for all Scala components:- Client library (
delta-sharing-client) - Spark connector (
delta-sharing-spark) - Delta Sharing Server (
delta-sharing-server)
Running Tests for Specific Components
Running Specific Test Suites
Execute individual test suites using thetestOnly command:
Running Specific Tests Within a Suite
You can run individual tests by name:-z flag filters tests whose names contain the specified string.
Test Configuration
The build system includes optimized test configurations to improve performance and reduce memory usage.JVM Test Options
Tests run with the following JVM settings (configured inbuild.sbt):
- Disable Spark UI to reduce overhead
- Limit partition counts for faster tests
- Configure SSL for test environments
- Set maximum heap size to 1GB
Azure Test Configuration
For tests requiring Azure access, configure credentials:Cross-Version Testing
Test against multiple Scala versions:Continuous Testing
Automatic test execution on file changes:Press Enter to manually trigger a test run. Press Ctrl+C to exit watch mode.
Test Output and Debugging
Verbose Test Output
Parallel Test Execution
By default, parallel execution is disabled (ThisBuild / parallelExecution := false in build.sbt) to prevent resource conflicts. To enable parallel tests:
Code Quality Checks
Delta Sharing enforces code quality through automatic style checking.Scala Style Checks
ScalaStyle checks run automatically with compilation and testing:Python Code Quality
The Python connector includes linting and formatting tools:Test Best Practices
Run Before Commits
Always run tests before committing code changes to catch issues early.
Write Descriptive Tests
Use clear test names that describe what is being tested.
Test Edge Cases
Include tests for error conditions and boundary cases.
Keep Tests Fast
Optimize tests to run quickly for better development experience.
Integration Testing
For integration tests requiring a running Delta Sharing Server:Common Test Failures
Out of Memory Errors
Out of Memory Errors
Solution: Increase JVM heap size
Port Already in Use
Port Already in Use
Solution: Kill processes using the required ports
Python Import Errors
Python Import Errors
Solution: Install package in development mode
Azure/AWS Credential Errors
Azure/AWS Credential Errors
Solution: Set up test credentials
ScalaStyle Failures
ScalaStyle Failures
Solution: Fix style violations or update configuration
Debugging Tests
Debug Python Tests
Run pytest with debugger integration:Debug Scala Tests
Run tests with remote debugging enabled:Next Steps
Building
Learn how to build Delta Sharing from source
Contributing
Submit your tested changes upstream
CI/CD
Understand the continuous integration pipeline