Package rosunit :: Module pyunit
[frames] | no frames]

Module pyunit

source code

Wrapper for running Python unittest within rosunit/rostest framework.

Functions
 
unitrun(package, test_name, test, sysargs=None, coverage_packages=None)
Wrapper routine from running python unitttests with JUnit-compatible XML output.
source code
 
start_coverage(packages) source code
 
stop_coverage(packages, html=None) source code
Variables
  __package__ = 'rosunit'
Function Details

unitrun(package, test_name, test, sysargs=None, coverage_packages=None)

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.

WARNING: unitrun() will trigger a sys.exit() on test failure in order to properly exit with an error code. This routine is meant to be used as a main() routine, not as a library.

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
  • sysargs ([str]) - (optional) alternate sys.argv

stop_coverage(packages, html=None)

source code 
Parameters:
  • packages ([str]) - list of packages to generate coverage reports for
  • html (str) - (optional) if not None, directory to generate html report to