schrodinger.test.stu.testscripts module

Contains the class TestScript, which provides methods to create, modify, extract and delete a test script. See also the convenience function l{getTestFromDir}, which can be used to read a test from a directory.

schrodinger.test.stu.testscripts.get_test_id(directory)

Get the test ID based on the directory name. Also guesses whether the test has already been run.

Return type

tuple(int/str, bool)

Returns

(TestID, Was the test executed?)

schrodinger.test.stu.testscripts.getTestFromDir(username, directory, filename='README')

Read test information from a file.

class schrodinger.test.stu.testscripts.TestScript(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=True, resource_uri=None, download=None, upload=None, tags=None, minimum_version=None, maximum_version=None, executed=False, **kwargs)

Bases: object

__init__(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=True, resource_uri=None, download=None, upload=None, tags=None, minimum_version=None, maximum_version=None, executed=False, **kwargs)
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

classmethod read_readme(readme)

Read README and extract script information.

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

write_readme(fileobj=None)

Print or return the README data.

validate(**kwargs)

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

runWorkup(job=None, registered_workups=None)

Run my workup.

getNewExecuteDirectory(attempts=120)

Get a new directory name.

copyToScratch()

Copy files to a scratch folder.

recoverFromScratch(get_license=True)

Remove scratch folder and prepare to add/modify the test.

classmethod find_substitution_files(directory)

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

substituteFiles()

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

useJC()

Determines whether the script will be run under jobcontrol, uses self._useJC as a default value. :return: Should this script be run under jobcontrol? :rtype: bool

runsRemotely()
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()

Dump test object as a dict

schrodinger.test.stu.testscripts.validate_command_for_host(command, tags, test_id, product)

Raises READMESyntaxError if command has encoded incorrect host information. In general, there should be no -HOST information so stu can decide what hosts to run with.

NOTE: This is same as code in forms validation for stu server. Use this code once we integrate stu server to use from mmshare.

Parameters
  • command (str) – commandline which will be executed

  • tags (set(str)) – list of tags associated with test

  • test_id (str) – name of test (used for error reporting)

  • product (str) – name of Product test is associated with

schrodinger.test.stu.testscripts.README2TEST = {}

Correspondence between README values and test values.

schrodinger.test.stu.testscripts.TEST2README = {}

Correspondence between README values and test values.

schrodinger.test.stu.testscripts.LIST_VALUES = []

Values that are lists.