Package rocon_test :: Module test_parent
[frames] | no frames]

Source Code for Module rocon_test.test_parent

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