Testing with PyTest

rkd.core.api.testing provides methods for running tasks with output capturing, a well as mocking RKD classes for unit testing of your task methods. To use our API just extend one of base classes.

Example: Mocking RKD-specific dependencies in TaskInterface

from rkd.core.api.inputoutput import BufferedSystemIO
from rkd.core.api.testing import FunctionalTestingCase

# ...

class SomeTestCase(FunctionalTestingCase):

    # ...

    def test_something_important(self):
        task = LineInFileTask()  # put your task class there
        io = BufferedSystemIO()

        BasicTestingCase.satisfy_task_dependencies(task, io=io)

        self.assertEqual('something', task.some_method())

Documentation