pyspark-test
Check that left and right spark DataFrame are equal.
What it is and what it does
pyspark-test is a lightweight assertion library for comparing PySpark DataFrames in unit tests. It wraps the core comparison logic into a single function, `assert_pyspark_df_equal`, inspired by pandas' testing module but adapted for Spark's distributed DataFrame API. The function checks row-by-row equality and can optionally verify data types, column names, and column ordering; it also supports sorting DataFrames before comparison via an `order_by` parameter.
The package is intended as a drop-in testing helper for Spark-based data pipelines. It depends only on pyspark and installs as a pure Python wheel with no compiled dependencies. However, the project is dormant—no releases since October 2021 and no commits since December 2023—so it may not work with recent PySpark versions or handle edge cases that have emerged since then.
Use it for:
- Unit testing Spark ETL jobs by asserting that transformed DataFrames match expected output.
- Validating data pipeline stages by comparing intermediate DataFrames with known-good reference data.
- Regression testing after schema changes by checking both data and column metadata.
- Comparing DataFrames with flexible strictness—e.g., ignoring column order in some tests but enforcing it in others.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a testing utility to assert equality between two PySpark DataFrames with configurable strictness for data types, column names, and column ordering.
Yes, if you are writing unit tests for PySpark pipelines and need a simple DataFrame comparison tool. The low install friction and permissive license make it easy to adopt. However, be aware that the project is dormant and may not support the latest PySpark versions—verify compatibility with your environment before relying on it in production test suites.
Install
pyspark-test on PyPI
pip
pip install pyspark-testuv
uv add pyspark-testpoetry
poetry add pyspark-testInstalling pyspark-test
Before you install
Low install friction with a single runtime dependency on pyspark. Maintenance is dormant—last release was in 2021 and last commit in December 2023—so expect no active bug fixes or updates.
License in practice
Licensed under Apache 2.0 (permissive), so you may use, modify, and distribute freely with minimal restrictions.
Quickstart
from pyspark_test import assert_pyspark_df_equal
assert_pyspark_df_equal(left_df, right_df, check_dtype=True, check_column_names=False)
Requires pyspark to be installed and a Spark context to be available at runtime.
Verify before relying
- Whether the package handles edge cases like very large DataFrames or complex nested schemas.
- Current compatibility with recent PySpark versions (last release was 2021).
- Performance characteristics when comparing DataFrames with millions of rows.
Package facts
| License | Apache Software License (Apache 2.0) (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — pyspark |
| Maintenance | dormant — 1,748 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 377,616/month — #7,122 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pyspark_test-0.2.0-py3-none-any.whl
Keywords: assert, pyspark, unit, test, testing, compare
Tags
More Testing packages
Pluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
virtualenvvirtualenv creates isolated Python environments…
permissive · top 100 on PyPI
coverageCoverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
pytest-asynciopytest-asyncio is a pytest plugin that enables…
permissive · top 1,000 on PyPI
pytest-json-ctrfA pytest plugin that generates test reports in…
permissive · top 1,000 on PyPI
chispaProvides assertion methods for testing PySpark…
permissive · top 5,000 on PyPI
datacompyDataComPy compares two DataFrames across…
permissive · top 5,000 on PyPI
databricks-testProvides a unit testing framework for…
permissive · top 15,000 on PyPI
pytest-sparkA pytest plugin that integrates Apache Spark…
permissive · top 15,000 on PyPI
dirty-equalsProvides custom equality matchers that make…
permissive · top 5,000 on PyPI
spark-expectationsSpark Expectations is a data quality framework…
unclear · top 15,000 on PyPI
quinnQuinn provides helper methods for PySpark…
permissive · top 15,000 on PyPI
cualleeCuallee provides a dataframe-agnostic API to…
permissive · top 15,000 on PyPI
pyspark-extensionProvides Python bindings and utilities for…
permissive · top 15,000 on PyPI
findsparkAdds Spark to Python's import path at runtime,…
permissive · top 5,000 on PyPI