Package schrodinger :: Package test :: Package stu :: Module testscripts :: Class TestScript
[hide private]
[frames] | no frames]

Class TestScript

object --+
         |
        TestScript

Instance Methods [hide private]
 
__init__(self, product, priority, description, command, workup, build_modified=None, creator=None, number=None, directory=None, question='', product_subfeature=None, mpi_enabled=None, allowed_cpu='', jira_tracking=None, disabled_for_bug=False, unsupported_platforms=None, shared_files=(), substitution_files=(), useJC=None, resource_uri=None, download=None, upload=None, tags=None, minimum_version=None, maximum_version=None, executed=False, **kwargs)
x.__init__(...) initializes x; see help(type(x)) for signature
 
write_readme(self, fileobj=None)
Print or return the README data.
 
validate(self, **kwargs)
Validate the data stored in a TestScript object.
list
parseWorkup(self, outcome_workup_string, delim_and='&&', delim_or='||')
Splits the outcome_workup_string into correctly formatted outcome workups.
 
_parseSingleWorkup(self, outcome_workup_string)
Method takes an outcome in the format of 'method(args)' as a python call and splits into a method name and argument list
 
_parseWorkupArgs(self, args_string)
Parse the argument list from a 'method(arg1, arg2, arg3)' into a list.
 
runWorkup(self, job=None)
Run my workup.
 
getNewExecuteDirectory(self, attempts=120)
Get a new directory name.
 
copyToScratch(self)
Copy files to a scratch folder.
 
recoverFromScratch(self, get_license=True)
Remove scratch folder and prepare to add/modify the test.
 
_getReferenceLicense(self)
Get the license file created in the scratch directory and move it to the test directory.
 
substituteFiles(self)
Replace substitution expressions in files that require it.
 
_substituteInPlace(self, filename)
Replace ${SHARED} and ${CWD} in filename with the shared directory and test directory, respectively.
bool
useJC(self)
Determines whether the script will be run under jobcontrol, uses self._useJC as a default value (if it is defined).
 
runsRemotely(self)
A job is available to run on a remote host if: * It is a jobcontroljob that doesn't have the require:localhost tag * It is not a jobcontroljob, but it has ${HOST} in the command.
 
toDict(self)
Dump test object as a dict
 
__str__(self)
str(x)

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Class Methods [hide private]
 
_getTestFromDict(cls, data)
Creates a test object using a dictionary keyed on the names used in the repo and DB.
 
read_readme(cls, readme)
Read README and extract script information.
 
find_substitution_files(cls, directory)
Run through all files in directory and look for the string "${SHARED} or ${CWD}".
Instance Variables [hide private]
  id
Test number
  outcome
bool : Success or Failure of the test
  workup_messages
str : Messages from the workup
  failure_type
str : Failure category as per SHARED-3037
  timing
float : how long the test took to run (s)
  exit_status
str : exit status
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, product, priority, description, command, workup, build_modified=None, creator=None, number=None, directory=None, question='', product_subfeature=None, mpi_enabled=None, allowed_cpu='', jira_tracking=None, disabled_for_bug=False, unsupported_platforms=None, shared_files=(), substitution_files=(), useJC=None, resource_uri=None, download=None, upload=None, tags=None, minimum_version=None, maximum_version=None, executed=False, **kwargs)
(Constructor)

 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

read_readme(cls, readme)
Class Method

 

Read README and extract script information.

Format is keyword=value pairs. Also does limited boolean parsing.

validate(self, **kwargs)

 

Validate the data stored in a TestScript object. Should be done when instantiating one or dumping it to file.

parseWorkup(self, outcome_workup_string, delim_and='&&', delim_or='||')

 

Splits the outcome_workup_string into correctly formatted outcome workups.

Parameters:
  • outcome_workup_string (str) - outcome_workup line from the README
  • delim_and (str) - The "and" logical delimiter used in the outcome_workup_string
  • delim_or (str) - The "or" logical delimiter used in the outcome_workup_string.
Returns: list
A list of lists of parsed outcome workups. (exterior list is logical OR and interior is logical AND)

_getReferenceLicense(self)

 

Get the license file created in the scratch directory and move it to the test directory. Assumes both self.directory and self.original_directory are set, should be run from recoverFromScratch.

find_substitution_files(cls, directory)
Class Method

 

Run through all files in directory and look for the string "${SHARED} or ${CWD}". Only text files need to be processed.

substituteFiles(self)

 

Replace substitution expressions in files that require it. Requires that the substitution files already be identified.

useJC(self)

 

Determines whether the script will be run under jobcontrol, uses self._useJC as a default value (if it is defined). If it is not, decides based on the automated_cmd. Uses constants.utilities_not_under_jobcontrol, constants.top_level_drivers_not_under_jobcontrol, constants.scripts_under_jobcontrol, and constants.JOB_dependent_utils.

Returns: bool
Should this script be run under jobcontrol?

__str__(self)
(Informal representation operator)

 

str(x)

Overrides: object.__str__
(inherited documentation)