Package rostest

Package rostest

source code

Interface for using rostest from other Python code as well as running Python unittests with additional reporting mechanisms and rosbuild (CMake) integration.

Submodules

Functions
 
deprecated(func)
This is a decorator which can be used to mark functions as deprecated.
source code
xmlrpclib.ServerProxy
get_master()
Get an XMLRPC handle to the Master.
source code
 
is_publisher(topic, publisher_id)
Predicate to check whether or not master think publisher_id publishes topic :returns: ``True`` if still register as a publisher, ``bool`` :raises: IOError If communication with master fails
source code
 
is_subscriber(topic, subscriber_id)
Check whether or not master think subscriber_id subscribes to topic
source code
 
rosrun(package, test_name, test, sysargs=None)
Run a rostest/unittest-based integration test.
source code
 
rostestmain() source code
 
run(package, test_name, test, sysargs=None)
Run a rostest/unittest-based integration test.
source code
 
unitrun(*args, **kwargs)
Wrapper routine from running python unitttests with JUnit-compatible XML output.
source code
Variables
  XML_OUTPUT_FLAG = '--gtest_output=xml:'
  __package__ = 'rostest'
Function Details

deprecated(func)

source code 

This is a decorator which can be used to mark functions as deprecated. It will result in a warning being emmitted when the function is used.

get_master()

source code 

Get an XMLRPC handle to the Master. It is recommended to use the `rosgraph.masterapi` library instead, as it provides many conveniences.

Returns: xmlrpclib.ServerProxy
XML-RPC proxy to ROS master

is_subscriber(topic, subscriber_id)

source code 

Check whether or not master think subscriber_id subscribes to topic

:returns: ``True`` if still register as a subscriber, ``bool`` :raises: IOError If communication with master fails

rosrun(package, test_name, test, sysargs=None)

source code 

Run a rostest/unittest-based integration test.

Parameters:
  • package (str) - name of package that test is in
  • test_name (str) - name of test that is being run
  • test (unittest.TestCase, or string) - a test case instance or a name resolving to a test case or suite
  • sysargs (list) - command-line args. If not specified, this defaults to sys.argv. rostest will look for the --text and --gtest_output parameters

run(package, test_name, test, sysargs=None)

source code 

Run a rostest/unittest-based integration test.

Parameters:
  • package (str) - name of package that test is in
  • test_name (str) - name of test that is being run
  • test (unittest.TestCase, or string) - a test case instance or a name resolving to a test case or suite
  • sysargs (list) - command-line args. If not specified, this defaults to sys.argv. rostest will look for the --text and --gtest_output parameters

unitrun(*args, **kwargs)

source code 

Wrapper routine from running python unitttests with JUnit-compatible XML output. This is meant for unittests that do not not need a running ROS graph (i.e. offline tests only).

This enables JUnit-compatible test reporting so that test results can be reported to higher-level tools.

Parameters:
  • package (str) - name of ROS package that is running the test
  • coverage_packages ([str]) - list of Python package to compute coverage results for. Defaults to package
Decorators:
  • @deprecated