Package qm :: Package test :: Package classes :: Module command :: Class ShellScriptTest
[hide private]
[frames] | no frames]

Class ShellScriptTest
source code

         object --+                
                  |                
extension.Extension --+            
                      |            
      runnable.Runnable --+        
                          |        
                  test.Test --+    
                              |    
                   ExecTestBase --+
                                  |
                                 ShellScriptTest

Check a shell script's output and exit code.

A 'ShellScriptTest' runs the shell script provided and compares its standard output, standard error, and exit code with expected values. The shell script may be provided with command-line arguments and/or standard input.

QMTest determines which shell to use by the following method:

Nested Classes [hide private]

Inherited from test.Test: OutcomeField, TestField

Inherited from runnable.Runnable: ResourceField

Inherited from extension.Extension: Type, __metaclass__


Instance Methods [hide private]
  Run(self, context, result)
Run the test.
  _GetShell(self, context)
Return the shell to use to run this test.

Inherited from ExecTestBase: MakeEnvironment, RunProgram, ValidateOutput

Inherited from test.Test: GetTargetGroup

Inherited from runnable.Runnable: GetAttachments, GetDatabase, GetId, __init__

Inherited from extension.Extension: GetClassName, GetExplicitArguments, MakeDomDocument, MakeDomElement, Write, __getattr__

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__


Class Variables [hide private]
arguments  
_allow_arg_names_matching_class_vars True if it is OK for fields to have the same name as class variables.
_argument_dictionary  
_argument_list  
script  

Inherited from ExecTestBase: environment, exit_code, stderr, stdin, stdout, timeout

Inherited from test.Test: PREREQUISITES_FIELD_ID, kind, prerequisites, target_group

Inherited from runnable.Runnable: EXTRA_DATABASE, EXTRA_ID, RESOURCE_FIELD_ID, resources

Inherited from object: __class__


Method Details [hide private]

Run(self, context, result)

source code 

Run the test.

'context' -- A 'Context' giving run-time parameters to the test.

'result' -- A 'Result' object. The outcome will be 'Result.PASS' when this method is called. The 'result' may be modified by this method to indicate outcomes other than 'Result.PASS' or to add annotations.
Overrides: test.Test.Run

_GetShell(self, context)

source code 

Return the shell to use to run this test.

'context' -- As for 'Test.Run'.

returns -- A sequence of strings giving the path and arguments to be supplied to the shell. The default implementation uses the value of the context property 'ShellScriptTest.script_shell', or, if that is not defined, a platform-specific default.

Class Variable Details [hide private]

arguments

Value:
[]                                                                     
      

_allow_arg_names_matching_class_vars

True if it is OK for fields to have the same name as class variables.

If this variable is set to true, it is OK for the 'arguments' to contain a field whose name is the same as a class variable. That makes the 'default_value' handling for fields fail, and is generally confusing.

This module no longer allows such classes, unless this variable is set to true. That permits legacy extension classes to continue working, while preventing new extension classes from making the same mistake.
Value:
1                                                                     
      

_argument_dictionary

Value:
{'arguments': <<class 'qm.fields.SetField'> arguments>,
 'environment': <<class 'qm.fields.SetField'> environment>,
 'exit_code': <<class 'qm.fields.IntegerField'> exit_code>,
 'prerequisites': <<class 'qm.fields.SetField'> prerequisites>,
 'resources': <<class 'qm.fields.SetField'> resources>,
 'script': <<class 'qm.fields.TextField'> script>,
 'stderr': <<class 'qm.fields.TextField'> stderr>,
 'stdin': <<class 'qm.fields.TextField'> stdin>,
...                                                                    
      

_argument_list

Value:
[<<class 'qm.test.test.TargetGroupField'> target_group>,
 <<class 'qm.fields.TextField'> stderr>,
 <<class 'qm.fields.TextField'> stdout>,
 <<class 'qm.fields.SetField'> prerequisites>,
 <<class 'qm.fields.TextField'> stdin>,
 <<class 'qm.fields.IntegerField'> exit_code>,
 <<class 'qm.fields.SetField'> environment>,
 <<class 'qm.fields.TextField'> script>,
...                                                                    
      

script

Value:
''