hypernets_processor.test.test_functions module

test_functions module - module with functions to help with testing

hypernets_processor.test.test_functions.create_test_ds(ds_format)

Returns sample ds with random data

Parameters:

ds_format (str) – format string of dataset

Returns:

test ds

Return type:

xarray.Dataset

hypernets_processor.test.test_functions.setup_test_anomaly_db(url)

Creates anomaly_db for testing, populated with test data

Parameters:

url (str) – database url

hypernets_processor.test.test_functions.setup_test_archive_db(url)

Creates archive_db for testing, populated with test data

Parameters:

url (str) – database url

hypernets_processor.test.test_functions.setup_test_context(raw_data_directory=None, archive_directory=None, anomaly_db_url=None, metadata_db_url=None, archive_db_url=None, create_directories=False, create_dbs=False)

Creates context for testing

Parameters:
  • raw_data_directory (str) – (optional) raw data directory, set if provided else default value used

  • archive_directory (str) – (optional) data archive directory, set if provided else default value used

  • anomaly_db_url (str) – (opitional) anomaly db url, set if provided

  • metadata_db_url (str) – (optional) metadata db url, set if provided else default value used

  • archive_db_url (str) – (opitional) archive db url, set if provided

  • create_directories (bool) – option to create test directories at specified paths (default: False)

  • create_dbs (bool) – option to create test databases at specified urls (default: False)

Returns:

test context

Return type:

hypernets_processor.context.Context

hypernets_processor.test.test_functions.setup_test_job_config(raw_data_directory=None)

Creates processor_config for testing

Parameters:

raw_data_directory (str) – (optional) raw data directory, set if provided else default value used

Returns:

test job configuration information

Return type:

configparser.RawConfigParser

hypernets_processor.test.test_functions.setup_test_logger()

Creates logger for testing

Returns:

test logger

Return type:

logging.Logger

hypernets_processor.test.test_functions.setup_test_metadata_db(url)

Creates metadata_db for testing, populated with test data

Parameters:

url (str) – database url

hypernets_processor.test.test_functions.setup_test_processor_config(archive_directory=None, metadata_db_url=None, archive_db_url=None, anomaly_db_url=None)

Creates processor_config for testing

Parameters:
  • archive_directory (str) – (optional) data archive directory, set if provided else default value used

  • metadata_db_url (str) – (optional) metadata db url, set if provided else default value used

  • archive_db_url (str) – (optional) archive db url, set if provided else default value used

  • anomaly_db_url (str) – (optional) anomaly db url, set if provided else default value used

Returns:

test processor configuration information

Return type:

configparser.RawConfigParser

hypernets_processor.test.test_functions.teardown_test_context(context, remove_directories=False, remove_dbs=False)

Removes test context and files

Parameters:
  • context (hypernets_processor.context.Context) – context to teardown

  • remove_dbs (bool) – option to remove test data directories (default: False)

  • remove_dbs – option to remove test database files (default: False)