test_downward.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # -*- coding: utf-8 -*-
00003 # Author: Yuki Furuta <furushchev@jsk.imi.i.u-tokyo.ac.jp>
00004 
00005 from __future__ import print_function
00006 import os
00007 import commands
00008 import time
00009 import sys
00010 import unittest
00011 from optparse import OptionParser
00012 import rospy
00013 
00014 
00015 class TestDownward(unittest.TestCase):
00016     def test_plan(self):
00017         self.assertTrue(os.path.isfile(DOMAIN))
00018         domain = DOMAIN
00019         self.assertTrue(os.path.isfile(PROBLEM))
00020         problem = PROBLEM
00021         config = "ipc seq-sat-fd-autotune-1"
00022         self.assertIsInstance(PLAN, str)
00023         plan_path = PLAN
00024         cmd = "rosrun downward plan %s %s %s --plan-file %s" % (domain,
00025                                                                 problem,
00026                                                                 config,
00027                                                                 plan_path)
00028         print("EXECUTING: ", cmd, file=sys.stderr)
00029         (status, output) = commands.getstatusoutput(cmd)
00030         print("DOWNWARD STATUS: %d, OUTPUT: %s" % (status, output), file=sys.stderr)
00031         self.assertEqual(status, 0)
00032 
00033         plan_real_path = plan_path + ".1"
00034         self.assertTrue(os.path.isfile(plan_real_path))
00035 
00036         with open(REF) as f_ref:
00037             ref_lines = f_ref.readlines()
00038         with open(plan_real_path) as f_plan:
00039             plan_lines = f_plan.readlines()
00040         self.assertSequenceEqual(ref_lines, plan_lines)
00041 
00042 if __name__ == '__main__':
00043     ARGV = rospy.myargv(argv=sys.argv)
00044     DOMAIN=ARGV[1]
00045     PROBLEM=ARGV[2]
00046     PLAN=ARGV[3]
00047     REF=ARGV[4]
00048     import rostest
00049     rostest.rosrun("downward", "test_downward", TestDownward)


downward
Author(s):
autogenerated on Wed Jul 10 2019 03:24:03