Package qm :: Package test :: Package classes :: Module command_host
[hide private]
[frames] | no frames]

Source Code for Module qm.test.classes.command_host

 1  ######################################################################## 
 2  # 
 3  # File:   command_host.py 
 4  # Author: Stefan Seefeld 
 5  # Date:   2006-10-24 
 6  # 
 7  # Contents: 
 8  #   CommandHost 
 9  # 
10  # Copyright (c) 2006 by CodeSourcery, Inc.  All rights reserved.  
11  # 
12  ######################################################################## 
13   
14  ######################################################################## 
15  # Imports 
16  ####################################################################### 
17   
18  from qm.fields import TextField, SetField 
19  from qm.test.classes import local_host 
20  import sys, os, os.path 
21   
22  ######################################################################## 
23  # Classes 
24  ####################################################################### 
25   
26 -class CommandHost(local_host.LocalHost):
27 """A CommandHost runs an executable through a command. 28 29 The 'command' parameter specifies the command to use, while 30 'command_args' contains a set of arguments to be passed to the 31 command.""" 32 33 34 command = TextField(description="Name of the command" 35 " used to run the executable.") 36 command_args = SetField(TextField(description="Set of arguments" 37 " passed to the command.")) 38
39 - def Run(self, path, arguments, environment = None, timeout = -1, 40 relative = False):
41 42 if (relative 43 or (not os.path.isabs(path) 44 and (path.find(os.path.sep) != -1 45 or (os.path.altsep 46 and path.find(os.path.altsep) != -1)))): 47 path = os.path.join(os.curdir, path) 48 arguments = self.command_args + [path] + arguments 49 return local_host.LocalHost.Run(self, self.command, 50 arguments, environment, timeout)
51