Skip to main content

pytest plugin to run the tests with support of pyspark.

Project description

pytest plugin to run the tests with support of pyspark (Apache Spark).

This plugin will allow to specify SPARK_HOME directory in pytest.ini and thus to make “pyspark” importable in your tests which are executed by pytest.

Also it defines session scope fixture spark_context which can be used in your tests.

Install

$ pip install pytest-spark

Usage

Set Spark location

To run tests with required spark_home location just add “spark_home” value to pytest.ini in your project directory:

[pytest]
spark_home = /opt/spark

pytest-spark will try to import pyspark from specified location.

Using fixture

Use fixture spark_context in your tests as a regular pyspark fixture. SparkContext instance will be created once and reused for the whole test session.

Example:

def test_my_case(spark_context):
    test_rdd = spark_context.parallelize([1, 2, 3, 4])
    # ...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest-spark-0.2.0.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

pytest_spark-0.2.0-py2.py3-none-any.whl (4.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pytest-spark-0.2.0.tar.gz.

File metadata

File hashes

Hashes for pytest-spark-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5beacee9f260066c6cd2f271c1875f803c631ea230949c48e80652346ec81d3e
MD5 35346358a8e8fad46f960000042da3d1
BLAKE2b-256 7d06cf2e097e29960aa59417edddf8fd809b07b64d20188932e807fca12725af

See more details on using hashes here.

File details

Details for the file pytest_spark-0.2.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_spark-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 374510b0fdf7dc0b52b31af7b05858bb76b58ca5ddb56247ca2d2bcc5b2e29c5
MD5 c020d34e21dd9cf004e0c374778e029c
BLAKE2b-256 09d14b244fe7c2109574f8f2ffa2f427bf75710b904b3a7167e55ceef0036bae

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page