test_utils package

Submodules

test_utils.config_utils module

test_utils.docker_utils module

test_utils.exceptions module

exceptions for test_utils cases

exception test_utils.exceptions.DockerNotFound

Bases: test_utils.exceptions.DockerUtilsException

cannot find/connect to Docker in environment

exception test_utils.exceptions.DockerUtilsException

Bases: test_utils.exceptions.TestUtilsException

general exception for docker_utils libraries

exception test_utils.exceptions.FirstRunWarning

Bases: UserWarning

unable to find existing schema in database

exception test_utils.exceptions.MajorSchemaUpdate

Bases: test_utils.exceptions.SchemaUtilsException

protect database from major schema updates – require human to run update

exception test_utils.exceptions.SchemaUtilsException

Bases: test_utils.exceptions.TestUtilsException

general exception for schema_utils libraries

exception test_utils.exceptions.TestUtilsException

Bases: Exception

general exception for prosper.test_utils modules

exception test_utils.exceptions.TestUtilsWarning

Bases: Warning

general warning for prosper.test_utils modules

exception test_utils.exceptions.UnhandledDiff

Bases: test_utils.exceptions.SchemaUtilsException

DeepDiff had output, but not handled as change

test_utils.schema_utils module

schema testers

class test_utils.schema_utils.MongoContextManager(config, _testmode=False, _testmode_filepath=PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/prospertestutils/checkouts/latest/prosper/test_utils'))

Bases: object

context manager for mongo connections

Notes

connection_str requires {username}, {password} format strings

Parameters:
  • config (prosper.common.prosper_config.ProsperConfig) – configparser-like object
  • _testmode (bool) – use a localdb rather than a prod one
  • _testmode_filepath (str) – path to localdb
class test_utils.schema_utils.Update

Bases: enum.Enum

enum for classifying what kind of update is required

first_run = 'first_run'
major = 'major'
minor = 'minor'
no_update = 'no_update'
test_utils.schema_utils.schema_helper(data, data_source, schema_name, schema_group, config, _collection_name='prosper_schemas', _testmode=False, _dump_filepath='')
test helper: generates schemas from data and checks them against a mongoDB.
Updates for minor changes (adding keys) Raises errors for major changes
Parameters:
  • data (dict) – data to generate jsonschema from (raw data)
  • data_source (str) – link to source
  • schema_name (str) – name of resource for tracking
  • schema_group (str) – group (project name) for grouping
  • config (prosper.common.ProsperConfig) – config object with [MONGO] credentials
  • _testmode (bool) – run on local database with TinyMongo
  • _dump_filepath (str) – path to dump files to
Returns:

???

Module contents