Skip to main content

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 uv:

uv add pytest-dataguard .

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

Metadata

Release files for pytest-dataguard 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-dataguard 1.0.3
File Size Uploaded
pytest_dataguard-1.0.3.tar.gz 4.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-dataguard 1.0.3
File Interpreter ABI Platform
pytest_dataguard-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 10.2 kB

Release files / pytest_dataguard-1.0.3.tar.gz

Download URL pytest_dataguard-1.0.3.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
1d476a79240f7a9a77d9974c2f75ddcff7c5ccac9d9c87bac503c35543f31c72
BLAKE2b-256 checksum
How to use checksums
86160abb3fc064b9eee6846f08ca920b3b26275b5316ea7df4e46cf68ba931dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2025.

Transparency log

Release files / pytest_dataguard-1.0.3-py3-none-any.whl

Download URL pytest_dataguard-1.0.3-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d14a3440af70d1047daea1ff7600e9df86e513ec4972dac19b32e01b1cfc7ab7
BLAKE2b-256 checksum
How to use checksums
c29efd5ba416227d6bf96e6ce97bfe5e395bae46757ab47932d7cb0018bb4602
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page