Skip to main content
https://badge.fury.io/py/django-data-tests.svg https://travis-ci.org/andrewbird2/django-data-tests.svg?branch=master https://codecov.io/gh/andrewbird2/django-data-tests/branch/master/graph/badge.svg

A Django app for specifying validation tests on data in your database.

Quickstart

Install Django Data Tests:

pip install django-data-tests

Add it to your INSTALLED_APPS:

INSTALLED_APPS = (
    ...
    'data_tests.apps.DataTestsConfig',
    ...
)

Add a data test to one of your existing models

from data_tests.registry import test_method
from django.db import models

class Cat(models.Model):
    ...

    def make_noise(self):
        return 'Miaow!'

    @test_method('Check the cat miaows appropriately')
    def check_cat_sound(self):
        noise = self.noise()
        if noise != 'Miaow!':
            return False, 'Cat made the wrong noise: %s' % noise
        else:
            return True

You can run your data tests with the management command

./manage.py rundatatests

Alternatively, run them whenever the object is saved in the admin

from django.contrib import admin
from data_tests.admin import DataTestsAdminMixin

class CatAdmin(DataTestsAdminMixin, admin.ModelAdmin):
    ...

History

0.1.0 (2019-11-18)

  • First release on PyPI.

Metadata

Release files for django-data-tests 0.6.0

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

Source distribution (sdist)

Source distribution for django-data-tests 0.6.0
File Size Uploaded
django-data-tests-0.6.0.tar.gz 10.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-data-tests 0.6.0
File Interpreter ABI Platform
django_data_tests-0.6.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 23.3 kB

Release files / django-data-tests-0.6.0.tar.gz

Download URL django-data-tests-0.6.0.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b1eaccc20fdb1b2db9c2ad0f921e0e81be2e43a50fddd0ce1920fa023189ab6b
BLAKE2b-256 checksum
How to use checksums
c12179137ce3f04dbad18746c3ad95737baaa79d3cc791ad38b8a325e90eabd8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.6.9

Release files / django_data_tests-0.6.0-py2.py3-none-any.whl

Download URL django_data_tests-0.6.0-py2.py3-none-any.whl
Size 13.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
13fba5203429e7757e8669bb267b88175a18b03d0d538cfb66d5fc2beae95d55
BLAKE2b-256 checksum
How to use checksums
efb69480b8ef134b631b888016355afebf583bbb332ae8e68b2247500fb8bb3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.6.9

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

1 release file

0.2.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