Skip to main content

Data validation and integrity testing for your datasets using pytest.

Project description

pytest-dataguard

A pytest plugin for validating CSV data files as part of your test suite. It helps ensure your data files meet quality standards by checking for null values and enforcing uniqueness constraints on specified columns.

Features

  • Null value checks: Ensure your CSV files have no missing values.
  • Uniqueness checks: Verify that specified columns contain only unique values.
  • Easy integration: Run data validation as part of your regular pytest workflow.

Installation

Install via pip:

pip install pytest-dataguard

Or install from source:

pip install .

Usage

Run pytest with the plugin and specify the options:

pytest --file path/to/data.csv [--not_null] [--unique column1 --unique column2]
  • --file: Path to the CSV file to validate (required).
  • --not_null: Check that there are no null values in the file (optional, enabled by default).
  • --unique: Specify one or more columns to check for uniqueness. Can be used multiple times.

Example

Suppose you have a CSV file data.csv and want to ensure there are no nulls and that the id column is unique:

pytest --file data.csv --unique id

To check multiple columns for uniqueness:

pytest --file data.csv --unique id --unique email

How it works

When you run pytest with the pytest-dataguard options, the plugin will:

  • Load the specified CSV file using Polars
  • Check for null values --not_null is set by default
  • Check that specified columns have unique values if --unique is used
  • Fail the test session if any validation fails

Requirements

Contributing

Contributions are welcome! Please open issues or submit pull requests.

License

MIT License

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_dataguard-0.1.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

pytest_dataguard-0.1.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file pytest_dataguard-0.1.0.tar.gz.

File metadata

  • Download URL: pytest_dataguard-0.1.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pytest_dataguard-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c6898a76cf0ae1b15577f950e329b592790899468c4d8c1aed98e3a6e264c114
MD5 b66e80ad208368952afb4283be67d753
BLAKE2b-256 0c6bc1abdb65da975bafa8bb69a60b930fe0406dc154544d9dbe47d937967507

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_dataguard-0.1.0.tar.gz:

Publisher: python-package.yml on olaaustine/pytest_dataguard

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_dataguard-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_dataguard-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d9f9ccd2d37f4f03f3782a6c150a4b02f8710f6e8fa4ba04c07438b5e4e6e54
MD5 4eb52238724068991d31eb311189c35b
BLAKE2b-256 9fe1bfbe1e8574b7c29c552f4259da8fdd1bdbc89e6024350989d9e0a8028385

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_dataguard-0.1.0-py3-none-any.whl:

Publisher: python-package.yml on olaaustine/pytest_dataguard

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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