test_parent.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 #
3 # License: BSD
4 # https://raw.github.com/robotics-in-concert/rocon_multimaster/license/LICENSE
5 #
6 ##############################################################################
7 # Imports
8 ##############################################################################
9 
10 from __future__ import print_function
11 
12 import roslaunch
13 
14 ##############################################################################
15 # Test Launch Parent
16 ##############################################################################
17 
18 
19 class RoconTestLaunchParent(roslaunch.parent.ROSLaunchParent):
20  '''
21  Drop in replacement for ROSTestLaunchParent that lets us manage
22  the run id ourselves.
23  '''
24 
25  def __init__(self, run_id, config, roslaunch_files, port):
26  if config is None:
27  raise Exception("config not initialized")
28  # DJS : I'm turning off the is_core flag here as we don't ever seem
29  # to need it and it messes with things (usual parallel roslaunches
30  # that start up their own masters do not use it, only roscore).
31  super(RoconTestLaunchParent, self).__init__(run_id, roslaunch_files, is_core=False, port=port, is_rostest=True)
32  self.config = config
33 
34  def _load_config(self):
35  # disable super, just in case, though this shouldn't get called
36  pass
37 
38  def setUp(self):
39  """
40  initializes self.config and xmlrpc infrastructure
41  """
42  self._start_infrastructure()
43  self._init_runner()
44 
45  def tearDown(self):
46  if self.runner is not None:
47  runner = self.runner
48  runner.stop()
49  self._stop_infrastructure()
50 
51  def launch(self):
52  """
53  perform launch of nodes, does not launch tests. rostest_parent
54  follows a different pattern of init/run than the normal
55  roslaunch, which is why it does not reuse start()/spin()
56  """
57  if self.runner is not None:
58  return self.runner.launch()
59  else:
60  raise Exception("no runner to launch")
61 
62  def run_test(self, test):
63  """
64  run the test, blocks until completion
65  """
66  if self.runner is not None:
67  # run the test, blocks until completion
68  return self.runner.run_test(test)
69  else:
70  raise Exception("no runner")
def __init__(self, run_id, config, roslaunch_files, port)
Definition: test_parent.py:25


rocon_test
Author(s): Daniel Stonier
autogenerated on Mon Jun 10 2019 14:40:14