Public Member Functions | Public Attributes | Static Public Attributes | Private Attributes | List of all members
test.testbase.TestBase Class Reference
Inheritance diagram for test.testbase.TestBase:
Inheritance graph
[legend]

Public Member Functions

def __init__ (self, *args, **kwargs)
 
def create_publisher (self, topic, cls)
 
def init_node (self)
 
def run_command (self, communicate=True)
 
def run_rostest (cls)
 
def setUp (self)
 
def shutdown_node (self)
 
def spin_once (self, timeout)
 
def subTest (self, msg=None, **params)
 
def tearDown (self)
 
def verify_bags (self)
 
def verify_topics (self, topics, messages=None)
 

Public Attributes

 maxDiff
 

Static Public Attributes

string BAG_SUFFIX = "1" else ".db3"
 ROS bagfile extension. More...
 
list CMD_BASE = ["grepros"] + SEARCH_WORDS + \
 Base command for running grepros. More...
 
 DATA_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "data"))
 Test bags directory. More...
 
list EXPECTED_TOPIC_BASES = ["/match/this/intarray", "/match/this/header"]
 Topics expected in output, bag name appended. More...
 
list EXPECTED_WORDS = ["match_this"]
 Words expected in matched messages, bag name appended. More...
 
string INPUT_LABEL = "ROS bags"
 Name used in flow logging. More...
 
string NAME = ""
 Test name used in flow logging. More...
 
string OUTPUT_LABEL = ""
 Name used in flow logging. More...
 
 OUTPUT_SUFFIX = None
 Suffix for write output file, if any. More...
 
list SEARCH_WORDS = ["this"]
 Words searched in bag. More...
 
list SKIPPED_TOPIC_BASES = ["/not/this/intarray", "/match/this/not"]
 Topics not expected in output, bag name appended. More...
 
list SKIPPED_WORDS = ["not_this"]
 Words not expected in matched messages, bag name appended. More...
 

Private Attributes

 _bags
 
 _cmd
 
 _node
 
 _outfile
 
 _outname
 
 _proc
 

Detailed Description

Tests grepping from a source to a sink, with prepared test bags.

Definition at line 46 of file testbase.py.

Constructor & Destructor Documentation

◆ __init__()

def test.testbase.TestBase.__init__ (   self,
args,
**  kwargs 
)

Member Function Documentation

◆ create_publisher()

def test.testbase.TestBase.create_publisher (   self,
  topic,
  cls 
)

Definition at line 131 of file testbase.py.

◆ init_node()

def test.testbase.TestBase.init_node (   self)
Creates ROS1 or ROS2 node.

Definition at line 137 of file testbase.py.

◆ run_command()

def test.testbase.TestBase.run_command (   self,
  communicate = True 
)
Executes test command, returns command output text if communicate.

Definition at line 154 of file testbase.py.

◆ run_rostest()

def test.testbase.TestBase.run_rostest (   cls)
Runs rostest if ROS1.

Definition at line 199 of file testbase.py.

◆ setUp()

def test.testbase.TestBase.setUp (   self)

◆ shutdown_node()

def test.testbase.TestBase.shutdown_node (   self)
Shuts down ROS2 node, if any.

Definition at line 149 of file testbase.py.

◆ spin_once()

def test.testbase.TestBase.spin_once (   self,
  timeout 
)
 

Definition at line 163 of file testbase.py.

◆ subTest()

def test.testbase.TestBase.subTest (   self,
  msg = None,
**  params 
)
Shim for TestCase.subTest in Py2.

Definition at line 123 of file testbase.py.

◆ tearDown()

def test.testbase.TestBase.tearDown (   self)
Terminates subprocess and deletes temporary output files, if any.

Reimplemented in test.test_library.TestLibrary, test.test_live_to_console.TestLiveInputConsoleOutput, and test.test_bag_to_csv.TestBagInputCsvOutput.

Definition at line 112 of file testbase.py.

◆ verify_bags()

def test.testbase.TestBase.verify_bags (   self)
Asserts that ROS bags were found in data directory.

Definition at line 169 of file testbase.py.

◆ verify_topics()

def test.testbase.TestBase.verify_topics (   self,
  topics,
  messages = None 
)
Asserts that topics and message texts were emitted as expected.

Definition at line 176 of file testbase.py.

Member Data Documentation

◆ _bags

test.testbase.TestBase._bags
private

Definition at line 94 of file testbase.py.

◆ _cmd

test.testbase.TestBase._cmd
private

Definition at line 96 of file testbase.py.

◆ _node

test.testbase.TestBase._node
private

Definition at line 99 of file testbase.py.

◆ _outfile

test.testbase.TestBase._outfile
private

Definition at line 98 of file testbase.py.

◆ _outname

test.testbase.TestBase._outname
private

Definition at line 97 of file testbase.py.

◆ _proc

test.testbase.TestBase._proc
private

Definition at line 95 of file testbase.py.

◆ BAG_SUFFIX

string test.testbase.TestBase.BAG_SUFFIX = "1" else ".db3"
static

ROS bagfile extension.

Definition at line 65 of file testbase.py.

◆ CMD_BASE

list test.testbase.TestBase.CMD_BASE = ["grepros"] + SEARCH_WORDS + \
static

Base command for running grepros.

Definition at line 71 of file testbase.py.

◆ DATA_DIR

test.testbase.TestBase.DATA_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "data"))
static

Test bags directory.

Definition at line 62 of file testbase.py.

◆ EXPECTED_TOPIC_BASES

list test.testbase.TestBase.EXPECTED_TOPIC_BASES = ["/match/this/intarray", "/match/this/header"]
static

Topics expected in output, bag name appended.

Definition at line 83 of file testbase.py.

◆ EXPECTED_WORDS

list test.testbase.TestBase.EXPECTED_WORDS = ["match_this"]
static

Words expected in matched messages, bag name appended.

Definition at line 77 of file testbase.py.

◆ INPUT_LABEL

string test.testbase.TestBase.INPUT_LABEL = "ROS bags"
static

Name used in flow logging.

Definition at line 53 of file testbase.py.

◆ maxDiff

test.testbase.TestBase.maxDiff

Definition at line 91 of file testbase.py.

◆ NAME

string test.testbase.TestBase.NAME = ""
static

Test name used in flow logging.

Definition at line 50 of file testbase.py.

◆ OUTPUT_LABEL

string test.testbase.TestBase.OUTPUT_LABEL = ""
static

Name used in flow logging.

Definition at line 56 of file testbase.py.

◆ OUTPUT_SUFFIX

test.testbase.TestBase.OUTPUT_SUFFIX = None
static

Suffix for write output file, if any.

Definition at line 59 of file testbase.py.

◆ SEARCH_WORDS

list test.testbase.TestBase.SEARCH_WORDS = ["this"]
static

Words searched in bag.

Definition at line 68 of file testbase.py.

◆ SKIPPED_TOPIC_BASES

list test.testbase.TestBase.SKIPPED_TOPIC_BASES = ["/not/this/intarray", "/match/this/not"]
static

Topics not expected in output, bag name appended.

Definition at line 86 of file testbase.py.

◆ SKIPPED_WORDS

list test.testbase.TestBase.SKIPPED_WORDS = ["not_this"]
static

Words not expected in matched messages, bag name appended.

Definition at line 80 of file testbase.py.


The documentation for this class was generated from the following file:


grepros
Author(s): Erki Suurjaak
autogenerated on Sat Jan 6 2024 03:11:30