sloth.raw.runners: Multiple test runners

This module provides utilities for running multiple tests, or averaging tests.

class sloth.raw.runners.TestRunner(tests)

Convenience class to run multiple tests.

Parameters

tests (list or tuple or set) – List of sloth.raw.base.Test instances to run

run()

Generator, returns the results of running each test.

Return type

generator

Returns

Time it took to run each tests.

class sloth.raw.runners.AverageTest(test, n=None)

Run test n times and return the average time it took to run it.

Parameters
  • test (Test) – Test to average

  • n (int) – Number of times to run the test - the higher the more accurate. Defaults to 2.

run(n=None)

Run the average test, and return how long it took to run it, averaged.

Parameters

n (int) – Use this to override the n parameter passed in upon creation.

Returns

How long it took to run the test, averaged

Return type

float