spinnaker_testbase package

Submodules

spinnaker_testbase.ping module

class spinnaker_testbase.ping.Ping[source]

Bases: object

Platform-independent ping support.

static host_is_reachable(ip_address)[source]

Test if a host is unreachable via ICMP ECHO.

Note

This information may be cached in various ways. Transient failures are not necessarily detected or recovered from.

Parameters:

ip_address (str) – The IP address to ping. Hostnames can be used, but are not recommended.

Return type:

bool

static ping(ip_address)[source]

Send a ping (ICMP ECHO request) to the given host. SpiNNaker boards support ICMP ECHO when booted.

Parameters:

ip_address (str) – The IP address to ping. Hostnames can be used, but are not recommended.

Returns:

return code of subprocess; 0 for success, anything else for failure

Return type:

int

unreachable: Set[str] = {}

The unreachable host cache.

spinnaker_testbase.root_test_case module

class spinnaker_testbase.root_test_case.RootTestCase(methodName='runTest')[source]

Bases: TestCase

This holds the code shared by the all test and script checkers

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

static assert_not_spin_three()[source]

Will raise a SkipTest if run on a none virtual 4 chip board

Raises:

SkipTest – If we’re on the wrong sort of board

error_file()[source]

The file any error where reported to before a second run attempt

Returns:

Path to (possibly non existent) error file

report(message, file_name)[source]

Writes some text to the specified file

The file will be written in the env GLOBAL_REPORTS directory.

If no GLOBAL_REPORTS is defined the timestamp directory holding the run data is used.

Parameters:
  • message (str)

  • file_name (str) – local file name.

runsafe(method, retry_delay=3.0, skip_exceptions=None)[source]

Will run the method possibly a few times

Parameters:
  • method (callable)

  • retry_delay (float)

  • skip_exceptions (list(class)) – list of exception classes to convert in SkipTest

spinnaker_testbase.test_no_job_destroy module

class spinnaker_testbase.test_no_job_destroy.TestNoJobDestory(methodName='runTest')[source]

Bases: BaseTestCase

Used by Jenkins to check if a job was destroyed.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

test_no_destory_file()[source]

Checks for the error file and prints it out if found

Raises:

AssertionError – if the error file exists

Module contents

This Repository hold classes and script used for unit and integration tests

There is need to use this repository unless you want to run some or all tests locally

class spinnaker_testbase.BaseTestCase(methodName='runTest')[source]

Bases: RootTestCase

This extends unittest.TestCase to offer extra functions as needed.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

assert_logs_messages(log_records, sub_message, log_level='ERROR', count=1, allow_more=False)[source]

Tool to assert the log messages contain the sub-message.

Parameters:
  • log_records – list of log message

  • sub_message – text to look for

  • log_level – level to look for

  • count – number of times this message should be found

  • allow_more – If True, OK to have more than count repeats

get_app_iobuf_files() List[str][source]

Get a list of the application iobuf files.

Return type:

list(str)

get_provenance_files() List[str][source]

Gets a list of the Provenance files

Return type:

list(str)

get_system_iobuf_files() List[str][source]

Get a list of the system iobuf files.

Return type:

list(str)

setUp()[source]

Hook method for setting up the test fixture before exercising it.

class spinnaker_testbase.RootScriptBuilder[source]

Bases: object

Looks for example scripts that can be made into integration tests.

add_script(test_file, name, local_path, skip_imports)[source]
Parameters:
add_scripts(a_dir, prefix_len, test_file, too_long, exceptions, skip_exceptions)[source]
Parameters:
create_test_scripts(dirs, too_long=None, exceptions=None, skip_exceptions=None)[source]
Parameters:
  • dirs (str or list(str)) – List of dirs to find scripts in. These are relative paths to the repository

  • too_long (dict(str, str) or None) – Dict of files that take too long to run and how long. These are just the file name including the .py. They are mapped to a skip reason. These are only skip tests if asked to be (currently not done).

  • exceptions (dict(str, str) or None) – Dict of files that should be skipped. These are just the file name including the .py. They are mapped to a skip reason. These are always skipped.

  • skip_exceptions (dict(str,list(str))) –

    Dict of files and exceptions to skip on. These are just the file name including the .py. They are mapped to a list of INDIVIUAL import statements in the:

    from xyz import Abc
    

    format.

class spinnaker_testbase.ScriptChecker(methodName='runTest')[source]

Bases: RootTestCase

Will run a script. Typically as part of Integration Tests.

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

check_script(script, broken_msg=None, skip_exceptions=None)[source]
Parameters:
  • script (str) – relative path to the file to run

  • broken_msg (str) – message to print instead of raising an exception; no current use-case known

  • skip_exceptions (list(type) or None) – list of exception classes to convert in SkipTest