test_downward.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 # Author: Yuki Furuta <furushchev@jsk.imi.i.u-tokyo.ac.jp>
4 
5 from __future__ import print_function
6 import os
7 import commands
8 import time
9 import sys
10 import unittest
11 from optparse import OptionParser
12 import rospy
13 
14 
15 class TestDownward(unittest.TestCase):
16  def test_plan(self):
17  self.assertTrue(os.path.isfile(DOMAIN))
18  domain = DOMAIN
19  self.assertTrue(os.path.isfile(PROBLEM))
20  problem = PROBLEM
21  config = "ipc seq-sat-fd-autotune-1"
22  self.assertIsInstance(PLAN, str)
23  plan_path = PLAN
24  cmd = "rosrun downward plan %s %s %s --plan-file %s" % (domain,
25  problem,
26  config,
27  plan_path)
28  print("EXECUTING: ", cmd, file=sys.stderr)
29  (status, output) = commands.getstatusoutput(cmd)
30  print("DOWNWARD STATUS: %d, OUTPUT: %s" % (status, output), file=sys.stderr)
31  self.assertEqual(status, 0)
32 
33  plan_real_path = plan_path + ".1"
34  self.assertTrue(os.path.isfile(plan_real_path))
35 
36  with open(REF) as f_ref:
37  ref_lines = f_ref.readlines()
38  with open(plan_real_path) as f_plan:
39  plan_lines = f_plan.readlines()
40  self.assertSequenceEqual(ref_lines, plan_lines)
41 
42 if __name__ == '__main__':
43  ARGV = rospy.myargv(argv=sys.argv)
44  DOMAIN=ARGV[1]
45  PROBLEM=ARGV[2]
46  PLAN=ARGV[3]
47  REF=ARGV[4]
48  import rostest
49  rostest.rosrun("downward", "test_downward", TestDownward)


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