Package datk :: Package core :: Module tester
[hide private]
[frames] | no frames]

Module tester

source code

Functions [hide private]
 
test(f=None, timeout=5, main_thread=False, test=True)
Decorator function test to run distributed algorithm tests in safe environment.
source code
 
print_with_underline(text) source code
 
summarize()
Called at the end of a test suite.
source code
 
benchmark(Algorithm, Network, test)
Benchmarks the Algorithm on a given class of Networks.
source code
Variables [hide private]
  TIMEOUT = 5
  _lock = Lock()
  _num_tests = 0
  _failed_tests = set([])
  __package__ = 'datk.core'
Function Details [hide private]

test(f=None, timeout=5, main_thread=False, test=True)

source code 

Decorator function test to run distributed algorithm tests in safe environment. Logs failed tests.

Parameters:
  • f - the test (a function) to run.
  • timeout - the number of seconds to allow the test to run, before timing it out (causing it to fail).
  • main_thread - True iff the test cannot run on a thread other than the main thread.
  • test - If false, skips testing this function. Useful because it can be set to default to false, and then set to True for a select few tests currently being tested.

summarize()

source code 

Called at the end of a test suite. Prints out summary of failed tests

benchmark(Algorithm, Network, test)

source code 

Benchmarks the Algorithm on a given class of Networks. Samples variable network size, and plots results.

Parameters:
  • Algorithm - a subclass of SynchronousAlgorithm, the algorithm to test.
  • Network - a subclass of Network, the network on which to benchmark the algorithm.
  • test - a function that may throw an assertion error