morse.testing package

Submodules

morse.testing.exceptions module

exception MorseTestingError(value)[source]

Bases: Exception

General MORSE unittesting Error.

morse.testing.moos module

MOOS-based MorseTestCase (unit-tests)

The main feature is to launch MOOSDB at start.

class MOOSTestCase(methodName='runTest')[source]

Bases: morse.testing.testing.MorseTestCase

setUpMw()[source]

This method can be overloaded by subclasses to define environment setup, before the launching of the Morse environment pass

tearDownMw()[source]

This method can be overloaded by subclasses to clean up environment setup

morse.testing.ros module

ROS-based MorseTestCase (unit-tests)

The main feature is to launch ROS core at start.

class RosTestCase(methodName='runTest')[source]

Bases: morse.testing.testing.MorseTestCase

setUpMw()[source]

This method can be overloaded by subclasses to define environment setup, before the launching of the Morse environment pass

tearDownMw()[source]

This method can be overloaded by subclasses to clean up environment setup

morse.testing.testing module

class MorseBuilderFailureTestCase(methodName='runTest')[source]

Bases: morse.testing.testing.MorseTestCase

This subclass of MorseTestCase can be used to test MORSE handles properly ill-constructed Builder scripts.

It will fail if the Blender Game Engine get started.

wait_initialization()[source]

Wait until Morse is initialized

class MorseMoveTestCase(methodName='runTest')[source]

Bases: morse.testing.testing.MorseTestCase

This subclass of MorseTestCase can be used to check for moving actuator, basically by testing a complete pose

This class assumes lot of stuff to work properly:
  • the tested robot is called ‘robot’
  • the pose sensor is called ‘robot.pose’
  • if assertAlmostEqualPositionThenFix, it assumes there is a
    • a ‘robot.motion’ actuator (basically what we test)
    • a ‘robot.teleport’ actuator (to move to a specific situation)
assertAlmostEqualPosition(morse, tested_pos, precision)[source]

Test against a position, presented as an array of 6 double (x, y, z, yaw, pitch, roll)

assertAlmostEqualPositionThenFix(morse, tested_pos, precision)[source]

Test against a position, presented as an array of 6 double (x, y, z, yaw, pitch, roll). When done, move the robot to this specific position. It allows to reduce the cumulated error between the different part of the test

class MorseSwitchTimeMode(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_switch()[source]
class MorseTestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

generate_builder_script(test_case)[source]
run(result=None)[source]

Overwrite unittest.TestCase::run

Detect KeyBoardInterrupt exception , due to user or a SIGINIT In particular, it can happen if we detect an exception in the Morse execution. In this case, clean up correctly the environnement.

setUp()[source]

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

setUpEnv()[source]

This method must be overloaded by subclasses to define a simulation environment.

The code must follow the Builder API convention (without the import of the morsebuilder module which is automatically added).

setUpMw()[source]

This method can be overloaded by subclasses to define environment setup, before the launching of the Morse environment pass

startmorse(test_case)[source]

This starts MORSE in a new process, passing the script itself as parameter (to build the scene via the Builder API).

stopmorse()[source]

Cleanly stop MORSE

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

tearDownMw()[source]

This method can be overloaded by subclasses to clean up environment setup

wait_initialization()[source]

Wait until Morse is initialized

class MorseTestRunner(stream=None, descriptions=True, verbosity=1, failfast=False, buffer=False, resultclass=None, warnings=None, *, tb_locals=False)[source]

Bases: unittest.runner.TextTestRunner

run(suite)[source]

Run the given test case or test suite.

setup_logging()[source]
follow(file)[source]

Really emulate tail -f

See http://stackoverflow.com/questions/1475950/tail-f-in-python-with-no-time-sleep for a detailled discussion on the subject

main(*args, **kwargs)[source]

Module contents