poppy.core.test.
CommandTestCase
[source]¶Bases: object
The CommandTestCase class is designed to be overridden in derived classes to create unit tests for commands.
Example
def test_sub_command1(self):
# — create some fake data —
value1 = ‘value1’ value2 = ‘value2’
# — initialize the command —
- command = [‘pop’,
- ‘my_command’, ‘my_sub_command’, ‘–my_option1’, value1, ‘–my_option2’, value2, ‘–dry-run’]
# — run the command —
self.run_command(command)
# — make assertions —
# test the result assert sorted([‘file1’, ‘file2’]) == sorted(os.listdir(‘my_result_path’))
# (...)
config_path
= None¶database_identifier
= None¶settings
¶settings_path
= None¶poppy.core.test.
TaskTestCase
[source]¶Bases: object
The TaskTestCase class is designed to be overridden in derived classes to create unit tests for tasks.
Example
# — initialize the task — from my_plugin import task1
self.task = task1()
# — create some fake data — # (you can use directly pipeline attributes)
self.task.pipeline.properties.input_dir = ‘my_input_dir’ self.task.pipeline.properties.output = ‘my_output_dir’
# (...)
# — run the task —
self.run_task()
# — make assertions —
# test the result assert self.task.pipeline.properties.result == ‘my_result’
# (...)
# — initialize the task — from my_plugin import task2
self.task = task2()
# (...)
task
¶