first step towards using testbox properly
[tests.git] / system / TestMain.py
index 77c939f..576e8bb 100755 (executable)
@@ -36,11 +36,12 @@ class TestMain:
 
     def __init__ (self):
        self.path=os.path.dirname(sys.argv[0])
+        os.chdir(self.path)
 
     @staticmethod
     def show_env (options, message):
         utils.header (message)
-        utils.show_spec("main options",options)
+        utils.pprint("main options",options)
 
     @staticmethod
     def optparse_list (option, opt, value, parser):
@@ -108,12 +109,14 @@ steps refer to a method in TestPlc or to a step_* module
             self.options.steps = self.args
 
         # handle defaults and option persistence
-        for (recname,filename,default) in ( ('myplc_url','arg-myplc-url',"") , 
-                                            ('build_url','arg-build-url',TestMain.default_build_url) ,
-                                            ('ips','arg-ips',[]) , 
-                                            ('config','arg-config',TestMain.default_config) , ) :
-            print 'handling',recname
-            path="%s/%s"%(self.path,filename)
+        for (recname,filename,default) in (
+            ('build_url','arg-build-url',TestMain.default_build_url) ,
+            ('ips','arg-ips',[]) , 
+            ('config','arg-config',TestMain.default_config) , 
+            ('myplc_url','arg-myplc-url',"") , 
+            ) :
+#            print 'handling',recname
+            path=filename
             is_list = isinstance(default,list)
             if not getattr(self.options,recname):
                 try:
@@ -143,7 +146,7 @@ steps refer to a method in TestPlc or to a step_* module
                 for value in getattr(self.options,recname):
                     fsave.write(value + "\n")
             fsave.close()
-            utils.header('Saved %s into %s'%(recname,filename))
+#            utils.header('Saved %s into %s'%(recname,filename))
 
         # steps
         if not self.options.steps:
@@ -171,7 +174,7 @@ steps refer to a method in TestPlc or to a step_* module
                 print 'Cannot load config %s -- ignored'%modulename
                 raise
         # show config
-        utils.show_spec("Test specifications",all_plc_specs)
+        utils.show_test_spec("Test specifications",all_plc_specs)
         # build a TestPlc object from the result
         for spec in all_plc_specs:
             spec['disabled'] = False