Testing
TestChain
Bases: Chain
Source code in taskchain/utils/testing.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
|
__init__(tasks, mock_tasks=None, parameters=None, base_dir=None)
Helper class for testing part of a chain. Some tasks are present fully, some are mocked. Config is not needed, parameters are provided directly.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tasks |
List[Type[Task]]
|
list of task classes which should be part of the chain |
required |
mock_tasks |
Dict[Union[str, Type[Task]], Any]
|
other task which are needed (as input_tasks) in chain but their output is only mocked (by values of this dict) |
None
|
parameters |
Dict[str, Any]
|
parameter names and their values |
None
|
base_dir |
Path
|
path for data persistence, if None tmp dir is created |
None
|
Source code in taskchain/utils/testing.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
create_test_task(task, input_tasks=None, parameters=None, base_dir=None)
Helper function which instantiate task in such way, that parameters and input_tasks are given with arguments of this function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input_tasks |
Dict[Union[str, Type[Task]], Any]
|
mocked values of input_tasks of tested class |
None
|
parameters |
Dict[str, Any]
|
parameter names and their values |
None
|
base_dir |
Path
|
path for data persistence, if None tmp dir is created |
None
|
Source code in taskchain/utils/testing.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|