Skip to main content

A test framework for Python Spark application development

Project description

spark-tests

A test framework, that defines several test doubles, to facilitate Python Spark application development.

spark_tests.sql module

Defines the following test doubles:

  • FakeSparkSession
    • Stubs sql(sql_query) method to only log the sql_queries , not sending them to database for execution;
    • table(table_mame) and createDataFrame(data[, schema, samplingRatio, verifySchema]) methods delegate execution to the real SparkSession, but returns a FakeDataFrame instead of a DataFrame;
    • table(table_name) is often overridden in a subclass to return a table from a fake test database.
  • FakeDataFrame
    • write returns a FakeDFWriter;
    • Other methods work just like a real DataFrame, but return FakeDataFrames instead of DataFrames;
  • FakeDFWriter
    • Stubs a DataFrameWriter to only log Rows written, not writing them at all.

spark_tests.delta module

Defines FakeDeltaTable, that stubs merge(source, condition) to only log the merge operation, changing no data.

spark_tests.datetime module

Defines the following test doubles:

  • FakeDatetime
    • Stubs now() method to return always a predefined datetime.
  • FakeDate
    • Stubs today() method to return always a predefined date.

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

pyspark-tests-1.3.5.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyspark_tests-1.3.5-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file pyspark-tests-1.3.5.tar.gz.

File metadata

  • Download URL: pyspark-tests-1.3.5.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.13

File hashes

Hashes for pyspark-tests-1.3.5.tar.gz
Algorithm Hash digest
SHA256 8c7a20a56d07af16719724804862688625218e75bba8999b83635b596735fc6c
MD5 b24bc150fb2eda9b6b0ea30f1293aef3
BLAKE2b-256 f735780e84d6c3f580b2ebc522c6196efe0e1398f48b7ecf6d653385ae28497c

See more details on using hashes here.

File details

Details for the file pyspark_tests-1.3.5-py3-none-any.whl.

File metadata

  • Download URL: pyspark_tests-1.3.5-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.13

File hashes

Hashes for pyspark_tests-1.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e4cc720e12ffa3a9c0344b83a4701b13c385fcccd2adc9f8ac9b0bb23f59ff22
MD5 0851858988a1fd1fe8db8d320060c259
BLAKE2b-256 33ceacc6c6fc957b050e9715e4e908eed7bc0352de5fa2b95b87bed65544132a

See more details on using hashes here.

Supported by

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