sourcefinder.testutil.decorators#
Functions#
|
Decorator to skip a test if its duration exceeds the maximum |
Decorator to disable tests that break Travis due to |
|
|
Decorator to skip a test if required data files are not |
Decorator to skip a test if database functionality is |
|
|
Decorator to skip a test if a required module is not |
Decorator to disable tests that perform potentially low-level |
Module Contents#
- sourcefinder.testutil.decorators.duration(test_duration)[source]#
Decorator to skip a test if its duration exceeds the maximum allowed duration.
This function checks the environment variable
TKP_MAXTESTDURATIONto determine the maximum allowed test duration. If the test’s duration exceeds this value, the test is skipped with an appropriate message.- Parameters:
- test_durationfloat
The duration of the test in seconds.
- Returns:
- function
A decorator that either skips the test or allows it to run.
- sourcefinder.testutil.decorators.high_ram_requirements()[source]#
Decorator to disable tests that break Travis due to out-of-memory issues.
This function checks the TRAVIS environment variable to determine if the tests are running in a Travis CI environment. If so, tests with high RAM requirements are skipped with an appropriate message.
- Returns:
- function
A decorator that either skips the test or allows it to run.
- sourcefinder.testutil.decorators.requires_data(*args)[source]#
Decorator to skip a test if required data files are not available.
This function checks for the existence of the specified data files. If any of the files do not exist, the test is skipped with an appropriate message.
- Parameters:
- *argsstr
Variable-length argument list of file paths to check.
- Returns:
- function
A decorator that either skips the test or allows it to run.
- sourcefinder.testutil.decorators.requires_database()[source]#
Decorator to skip a test if database functionality is disabled.
This function checks the environment variable TKP_DISABLEDB. If it is set to a truthy value, the test is skipped with an appropriate message.
- Returns:
- function
A decorator that either skips the test or allows it to run.
- sourcefinder.testutil.decorators.requires_module(module_name)[source]#
Decorator to skip a test if a required module is not available.
This function attempts to import the specified module. If the module cannot be imported, the test is skipped with an appropriate message.
- Parameters:
- module_namestr
The name of the module to check for availability.
- Returns:
- function
A decorator that either skips the test or allows it to run.
- sourcefinder.testutil.decorators.requires_test_db_managed()[source]#
Decorator to disable tests that perform potentially low-level database management operations, such as destroying and creating databases.
This decorator checks the environment variables to determine whether such tests should be enabled or skipped:
If the
TKP_DBENGINEenvironment variable is set to ‘monetdb’, the test is skipped because database management tests are not supported for MonetDB and must be tested manually.If the
TKP_TESTDBMANAGEMENTenvironment variable is set, the test is allowed to run.Otherwise, the test is skipped with an appropriate message.
- Returns:
- function
A decorator that either skips the test or allows it to run.