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)[source]¶
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')[source]¶
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)[source]¶
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)[source]¶
- 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)[source]¶
Read README and extract script information.
Format is keyword=value pairs. Also does limited boolean parsing.
- validate(**kwargs)[source]¶
Validate the data stored in a TestScript object. Should be done when instantiating one or dumping it to file.
- recoverFromScratch(get_license=True)[source]¶
Remove scratch folder and prepare to add/modify the test.
- classmethod find_substitution_files(directory)[source]¶
Run through all files in
directory
and look for the string “${SHARED} or ${CWD}”. Only text files need to be processed.
- substituteFiles()[source]¶
Replace substitution expressions in files that require it. Requires that the substitution files already be identified.
- useJC()[source]¶
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
- schrodinger.test.stu.testscripts.validate_command_for_host(command, tags, test_id, product)[source]¶
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.