Skip to main content

Library for generating and bootstrapping mock data

Project description

Knockoff Factory

codecov Test PyPi Release Docker Build License Python Versions Docker Image Size Python Wheel

A library for generating mock data and creating database fixtures that can be used for unit testing.

Table of content

Installation

pip install knockoff

Changelog

See the changelog for a history of notable changes to knockoff.

Documentation

We are working on adding more documentation and examples!

Unit Tests

Prerequisites

  • docker
  • poetry (curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python)

Some of the unit tests depend on a database instance. Knockoff will create ephemeral databases within that instance and clean them up when tests have completed. By default it will attempt to connect to an existing instance at postgresql://postgres@localhost:5432/postgres and will create and destroy databases per test. This postgres location can be overridden with the KNOCKOFF_TEST_DB_URI environment variable.

If no external postgres instance is available for testing, but postgresql is installed, the TEST_USE_EXTERNAL_DB environment variable can be set to 0. The fixtures will then rely on the testing.postgresql library to create ephemeral postgres instances per fixture.

If postgres is not available, dependent tests can be disabled with the following: export TEST_POSTGRES_ENABLED=0.

Create the database instance using docker:

docker run --rm  --name pg-docker -e POSTGRES_HOST_AUTH_METHOD=trust -d -p 5432:5432  postgres:11.9

Install poetry:

poetry install

Run unit test:

poetry run pytest

Future work

  • Further documentation and examples for SDK
  • Add yaml based configuration for SDK
  • Make extensible generic output for KnockffDB.insert (csv, parquet, etc)
  • Enable append option for KnockoffDB.insert
  • Autodiscover and populate all tables by using reflection and building dependency graph with foreign key relationships
  • Parallelize execution of dag. (e.g. https://ipython.org/ipython-doc/stable/parallel/dag_dependencies.html)

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

knockoff-4.2.1.tar.gz (33.5 kB view details)

Uploaded Source

Built Distribution

knockoff-4.2.1-py3-none-any.whl (51.6 kB view details)

Uploaded Python 3

File details

Details for the file knockoff-4.2.1.tar.gz.

File metadata

  • Download URL: knockoff-4.2.1.tar.gz
  • Upload date:
  • Size: 33.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.8.11 Linux/5.8.0-1036-azure

File hashes

Hashes for knockoff-4.2.1.tar.gz
Algorithm Hash digest
SHA256 2f54542de7a00dd34cded0c86373b5af99232a7d7b0d0c1e15fd7d89a776a8d9
MD5 aa6b7b2a50200523868cb3b13b9d2387
BLAKE2b-256 71563dd8c077ee87f1101d43a7d4101d0fc121eb77395561c8ae03a73ccb2ba9

See more details on using hashes here.

Provenance

File details

Details for the file knockoff-4.2.1-py3-none-any.whl.

File metadata

  • Download URL: knockoff-4.2.1-py3-none-any.whl
  • Upload date:
  • Size: 51.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.8.11 Linux/5.8.0-1036-azure

File hashes

Hashes for knockoff-4.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5503e5471759291846fbf1930bb6dae663d58a5a05247364c8bc8d77893223c4
MD5 482196c5071989428125174068d24f11
BLAKE2b-256 012e03898c24e5f9079738dfbcb24f2bd3c9fe9b3db92c920704b70a82c33930

See more details on using hashes here.

Provenance

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