Continuous Integration tests


Ocelot Windows build status


Ocelot Linux build status

Running the tests yourself


Running the Ocelot tests requires a source checkout from Github.

Run tests with py.test using the command py.test in the source directory. You can install pytest-xdist to run tests in parallel.

Writing tests

New transformation functions should be tested, and pull requests without tests will not be accepted. Note that for testing you should use the built-in mocks to avoid writing actual HTML reports or parsing directories full of .spold files. This means that any tests that which execute a system model should look like this:

from ocelot.tests.mocks import fake_report

def test_something(fake_report):
    report, data = system_model(some_data, some_functions)

fake_report is a py.test fixture that does two things. First, it write report data to a temporary directory and prevents HTML report generation. Second, the function extract_directory is short-circuited; Instead of passing a directory path as the first argument to system_model, you can just pass in data in the correct format.

Writing mocks makes tests better in a number of ways, but can sometimes be frustrating if things don’t work as expected. The following may be helpful: