$npx skillfedfor your agent

pytest-spark

pytest plugin to run the tests with support of pyspark.

With conditionsPyPI Python ModulesReleased May 2025390.7K downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — pytest_spark-0.8.0-py3-none-any.whl
v0.8.0 · released 2025-05-21 · 2 runtime deps: pytest, findspark

Yes, if you are testing PySpark code and want a lightweight, low-friction way to inject Spark fixtures into pytest. The plugin is stable (MIT license, no known vulnerabilities) and has been in active use since its first release in 2016-12-29. However, note that maintenance is aging—the last release was 450 days ago—so verify compatibility with your specific PySpark version before relying on it for new projects.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires either pyspark installed via pip or SPARK_HOME environment variable / pytest.ini configuration to locate a local Spark installation.
  • Low install friction with only two runtime dependencies (pytest and findspark).
  • Maintenance status is aging—last release was 450 days ago, though the repository remains active with a recent commit on 2025-05-21 and 88 stars.

License · maintenance · safety

MIT (permissive) — MIT license (permissive) places no restrictions on use, modification, or distribution in your own projects.

last release 2025-05-21 (450 days) · last repo commit 2025-05-21 · 88 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 390,724 downloads/mo, #7,020 on PyPI

Verify before relying

pip install pytest-spark

# In your test file:
def test_spark_session_dataframe(spark_session):
    test_df = spark_session.createDataFrame([[1,3],[2,4]], "a: int, b: int")
    # test your dataframe logic
  • Whether the package works reliably with modern PySpark versions given classifiers list only Python 3.2–3.6.
  • Current compatibility with Spark 3.4+ and Spark Connect functionality beyond what the description states.
  • Actual download volume and user base size to confirm production readiness.
Same gist for agents: .md · .json

What it is and what it does

pytest-spark is a pytest plugin that bridges Apache Spark and PySpark into your test environment. It lets you configure Spark's location and options (like external JAR packages) via pytest.ini or command-line flags, then provides two session-scoped fixtures—spark_context and spark_session—that your tests can use to create RDDs, DataFrames, and run Spark operations. The plugin handles initialization and teardown, so you write tests as if Spark were a normal pytest fixture.

The plugin is useful when you have PySpark code to test and want to avoid boilerplate Spark setup in each test. It supports both traditional SparkContext and modern SparkSession (Spark 2.0+) with Hive support enabled by default, and also works with Spark Connect for remote execution. Configuration is straightforward: either install pyspark via pip (no SPARK_HOME needed) or point the plugin to a local Spark installation.

Use it for

  • Test PySpark DataFrame transformations and SQL queries using the spark_session fixture in a standard pytest workflow.
  • Run RDD-based tests with spark_context fixture for legacy or lower-level Spark code.
  • Load external Spark packages (e.g., spark-xml) via spark_options in pytest.ini for integration tests.
  • Test Spark code against a remote Spark Connect server by setting SPARK_REMOTE or spark_connect_url.
  • Customize Spark executor and parallelism settings per test suite via pytest.ini without modifying test code.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

With conditions

Yes, if you are testing PySpark code and want a lightweight, low-friction way to inject Spark fixtures into pytest.

The plugin is stable (MIT license, no known vulnerabilities) and has been in active use since its first release in 2016-12-29. However, note that maintenance is aging—the last release was 450 days ago—so verify compatibility with your specific PySpark version before relying on it for new projects.

Install

pytest-spark on PyPI

Before you install

Low install friction with only two runtime dependencies (pytest and findspark). Maintenance status is aging—last release was 450 days ago, though the repository remains active with a recent commit on 2025-05-21 and 88 stars.

Requires either pyspark installed via pip or SPARK_HOME environment variable / pytest.ini configuration to locate a local Spark installation.

License in practice

MIT license (permissive) places no restrictions on use, modification, or distribution in your own projects.

Quickstart

pip install pytest-spark

# In your test file:
def test_spark_session_dataframe(spark_session):
    test_df = spark_session.createDataFrame([[1,3],[2,4]], "a: int, b: int")
    # test your dataframe logic

Verify before relying

  • Whether the package works reliably with modern PySpark versions given classifiers list only Python 3.2–3.6.
  • Current compatibility with Spark 3.4+ and Spark Connect functionality beyond what the description states.
  • Actual download volume and user base size to confirm production readiness.

Package facts

LicenseMIT permissive
Python supportNot specified
Install frictionLow. Pure-Python wheel
Runtime dependencies
2 packages
pytestfindspark
MaintenanceAging 450 days since the last release
Last repo commit
First released
Downloads390,724 / month, #7,020 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 4 - BetaFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.2Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Topic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: Testing

Evidence: pytest_spark-0.8.0-py3-none-any.whl

Tags

Capabilities
pytest spark pluginpyspark testingspark context fixturespark session pytesttest apache sparkpyspark unit testsspark integration testing
Topics
spark-testingpytest-plugindata-engineering
PyPI keywords
pytestsparkpysparkunittesttest

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “pytest spark plugin”

  • pytest-sparkA pytest plugin that integrates Apache Spark and PySpark into your…
  • chispaProvides assertion methods for testing PySpark code with descriptive…
  • kedro-datasetsKedro-Datasets provides data connectors for Kedro's DataCatalog,…

Give your agent the search over MCP, or paste the wish link into any chat.

More Python Modules packages

idna Worth it
PyPI · Python Modules · released Jun 2026

Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.

Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.

BSD-3-Clausepure Python · 3.9+
1.8Bdownloads / mo
setuptools Worth it
PyPI · Python Modules · released Aug 2026

Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.

MITpure Python · 3.10+
1.6Bdownloads / mo
PyYAML Worth it
PyPI · Python Modules · released Sep 2025

PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.

MITcompiled wheel · 3.8+
1.2Bdownloads / mo
pydantic Worth it
PyPI · Python Modules · released May 2026

Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.

MITpure Python · 3.9+
1.1Bdownloads / mo
annotated-types Worth it
PyPI · Python Modules · released Jul 2026

Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.

Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…

MITpure Python · 3.10+
871.3Mdownloads / mo
typing-inspection Worth it
PyPI · Python Modules · released Aug 2026

Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.

MITpure Python · 3.10+
783.0Mdownloads / mo

See also findspark · pytest-rabbitmq · pyspark-test · pytest-redis · pytest-mysql · dataproc-spark-connect · pyspark-extension · pytest-postgresql · pytest-django · sagemaker-feature-store-pyspark