Skip to content

Commit

Permalink
[test/test-samplerobot-*.py] Use Unittest for samplerobot example tes…
Browse files Browse the repository at this point in the history
…ting to enable test results output and respawn of rostest.
  • Loading branch information
snozawa committed Dec 17, 2015
1 parent b5e835e commit c33879e
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 35 deletions.
9 changes: 5 additions & 4 deletions test/test-samplerobot-abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
sys.path.append(os.path.join(check_output(['pkg-config', 'hrpsys-base', '--variable=prefix']).rstrip(),'share/hrpsys/samples/SampleRobot/')) # set path to SampleRobot

import samplerobot_auto_balancer
import unittest, rostest

if __name__ == '__main__':
samplerobot_auto_balancer.demo()
class TestSampleRobotAutoBalancer(unittest.TestCase):
def test_demo (self):
samplerobot_auto_balancer.demo()

## IGNORE ME: this code used for rostest
if [s for s in sys.argv if "--gtest_output=xml:" in s] :
import unittest, rostest
rostest.run('hrpsys', 'samplerobot_auto_balancer', unittest.TestCase, sys.argv)
rostest.run('hrpsys', 'samplerobot_auto_balancer', TestSampleRobotAutoBalancer, sys.argv)



Expand Down
9 changes: 5 additions & 4 deletions test/test-samplerobot-collision.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
sys.path.append(os.path.join(check_output(['pkg-config', 'hrpsys-base', '--variable=prefix']).rstrip(),'share/hrpsys/samples/SampleRobot/')) # set path to SampleRobot

import samplerobot_collision_detector
import unittest, rostest

if __name__ == '__main__':
samplerobot_collision_detector.demo()
class TestSampleRobotCollisionDetector(unittest.TestCase):
def test_demo (self):
samplerobot_collision_detector.demo()

## IGNORE ME: this code used for rostest
if [s for s in sys.argv if "--gtest_output=xml:" in s] :
import unittest, rostest
rostest.run('hrpsys', 'samplerobot_collision_detector', unittest.TestCase, sys.argv)
rostest.run('hrpsys', 'samplerobot_collision_detector', TestSampleRobotCollisionDetector, sys.argv)



Expand Down
9 changes: 5 additions & 4 deletions test/test-samplerobot-datalogger.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
sys.path.append(os.path.join(check_output(['pkg-config', 'hrpsys-base', '--variable=prefix']).rstrip(),'share/hrpsys/samples/SampleRobot/')) # set path to SampleRobot

import samplerobot_data_logger
import unittest, rostest

if __name__ == '__main__':
samplerobot_data_logger.demo()
class TestSampleRobotDataLogger(unittest.TestCase):
def test_demo (self):
samplerobot_data_logger.demo()

## IGNORE ME: this code used for rostest
if [s for s in sys.argv if "--gtest_output=xml:" in s] :
import unittest, rostest
rostest.run('hrpsys', 'samplerobot_data_logger', unittest.TestCase, sys.argv)
rostest.run('hrpsys', 'samplerobot_data_logger', TestSampleRobotDataLogger, sys.argv)



Expand Down
8 changes: 5 additions & 3 deletions test/test-samplerobot-el.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@
sys.path.append(os.path.join(check_output(['pkg-config', 'hrpsys-base', '--variable=prefix']).rstrip(),'share/hrpsys/samples/SampleRobot/')) # set path to SampleRobot

import samplerobot_soft_error_limiter
import unittest, rostest

if __name__ == '__main__':
samplerobot_soft_error_limiter.demo()
class TestSampleRobotSoftErrorLimiter(unittest.TestCase):
def test_demo (self):
samplerobot_soft_error_limiter.demo()

## IGNORE ME: this code used for rostest
if [s for s in sys.argv if "--gtest_output=xml:" in s] :
import unittest, rostest
rostest.run('hrpsys', 'samplerobot_soft_error_limiter', unittest.TestCase, sys.argv)
rostest.run('hrpsys', 'samplerobot_soft_error_limiter', TestSampleRobotSoftErrorLimiter, sys.argv)



Expand Down
9 changes: 5 additions & 4 deletions test/test-samplerobot-emergency.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
sys.path.append(os.path.join(check_output(['pkg-config', 'hrpsys-base', '--variable=prefix']).rstrip(),'share/hrpsys/samples/SampleRobot/')) # set path to SampleRobot

import samplerobot_emergency_stopper
import unittest, rostest

if __name__ == '__main__':
samplerobot_emergency_stopper.demo()
class TestSampleRobotEmergencyStopper(unittest.TestCase):
def test_demo (self):
samplerobot_emergency_stopper.demo()

## IGNORE ME: this code used for rostest
if [s for s in sys.argv if "--gtest_output=xml:" in s] :
import unittest, rostest
rostest.run('hrpsys', 'samplerobot_emergency_stopper', unittest.TestCase, sys.argv)
rostest.run('hrpsys', 'samplerobot_emergency_stopper', TestSampleRobotEmergencyStopper, sys.argv)



Expand Down
9 changes: 5 additions & 4 deletions test/test-samplerobot-kf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
sys.path.append(os.path.join(check_output(['pkg-config', 'hrpsys-base', '--variable=prefix']).rstrip(),'share/hrpsys/samples/SampleRobot/')) # set path to SampleRobot

import samplerobot_kalman_filter
import unittest, rostest

if __name__ == '__main__':
samplerobot_kalman_filter.demo()
class TestSampleRobotKalmanFilter(unittest.TestCase):
def test_demo (self):
samplerobot_kalman_filter.demo()

## IGNORE ME: this code used for rostest
if [s for s in sys.argv if "--gtest_output=xml:" in s] :
import unittest, rostest
rostest.run('hrpsys', 'samplerobot_kalman_filter', unittest.TestCase, sys.argv)
rostest.run('hrpsys', 'samplerobot_kalman_filter', TestSampleRobotKalmanFilter, sys.argv)



Expand Down
9 changes: 5 additions & 4 deletions test/test-samplerobot-rmfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
sys.path.append(os.path.join(check_output(['pkg-config', 'hrpsys-base', '--variable=prefix']).rstrip(),'share/hrpsys/samples/SampleRobot/')) # set path to SampleRobot

import samplerobot_remove_force_offset
import unittest, rostest

if __name__ == '__main__':
samplerobot_remove_force_offset.demo()
class TestSampleRobotRemoveForceOffset(unittest.TestCase):
def test_demo (self):
samplerobot_remove_force_offset.demo()

## IGNORE ME: this code used for rostest
if [s for s in sys.argv if "--gtest_output=xml:" in s] :
import unittest, rostest
rostest.run('hrpsys', 'samplerobot_remove_force_offset', unittest.TestCase, sys.argv)
rostest.run('hrpsys', 'samplerobot_remove_force_offset', TestSampleRobotRemoveForceOffset, sys.argv)



Expand Down
9 changes: 5 additions & 4 deletions test/test-samplerobot-sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
sys.path.append(os.path.join(check_output(['pkg-config', 'hrpsys-base', '--variable=prefix']).rstrip(),'share/hrpsys/samples/SampleRobot/')) # set path to SampleRobot

import samplerobot_sequence_player
import unittest, rostest

if __name__ == '__main__':
samplerobot_sequence_player.demo()
class TestSampleRobotSequencePlayer(unittest.TestCase):
def test_demo (self):
samplerobot_sequence_player.demo()

## IGNORE ME: this code used for rostest
if [s for s in sys.argv if "--gtest_output=xml:" in s] :
import unittest, rostest
rostest.run('hrpsys', 'samplerobot_sequence_player', unittest.TestCase, sys.argv)
rostest.run('hrpsys', 'samplerobot_sequence_player', TestSampleRobotSequencePlayer, sys.argv)



Expand Down
9 changes: 5 additions & 4 deletions test/test-samplerobot-st.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
sys.path.append(os.path.join(check_output(['pkg-config', 'hrpsys-base', '--variable=prefix']).rstrip(),'share/hrpsys/samples/SampleRobot/')) # set path to SampleRobot

import samplerobot_stabilizer
import unittest, rostest

if __name__ == '__main__':
samplerobot_stabilizer.demo()
class TestSampleRobotStabilizer(unittest.TestCase):
def test_demo (self):
samplerobot_stabilizer.demo()

## IGNORE ME: this code used for rostest
if [s for s in sys.argv if "--gtest_output=xml:" in s] :
import unittest, rostest
rostest.run('hrpsys', 'samplerobot_stabilizer', unittest.TestCase, sys.argv)
rostest.run('hrpsys', 'samplerobot_stabilizer', TestSampleRobotStabilizer, sys.argv)



Expand Down

0 comments on commit c33879e

Please sign in to comment.