Skip to main content
Delta Sharing uses different testing frameworks for its Python and Scala/Java components. This guide covers running tests for all components of the project.

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:
This command runs:
  • Unit tests in the delta_sharing package
  • 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:
When 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:
This executes tests for:
  • Client library (delta-sharing-client)
  • Spark connector (delta-sharing-spark)
  • Delta Sharing Server (delta-sharing-server)

Running Tests for Specific Components

1

Test Client Only

2

Test Spark Connector Only

3

Test Server Only

Running Specific Test Suites

Execute individual test suites using the testOnly command:

Running Specific Tests Within a Suite

You can run individual tests by name:
The -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 in build.sbt):
These settings:
  • 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:
Parallel execution may cause test failures due to port conflicts or shared resources. Use with caution.

Code Quality Checks

Delta Sharing enforces code quality through automatic style checking.

Scala Style Checks

ScalaStyle checks run automatically with compilation and testing:
To run style checks manually:

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:
1

Build the server

2

Configure test server

Create a test configuration file at conf/delta-sharing-server-test.yaml
3

Start test server

4

Run integration tests

In another terminal:

Common Test Failures

Solution: Increase JVM heap size
Solution: Kill processes using the required ports
Solution: Install package in development mode
Solution: Set up test credentials
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:
Then connect your IDE debugger to port 5005.

Next Steps

Building

Learn how to build Delta Sharing from source

Contributing

Submit your tested changes upstream

CI/CD

Understand the continuous integration pipeline