Control¶
- class lsst.sconsUtils.tests.Control(env, ignoreList=None, expectedFailures=None, args=None, tmpDir='.tests', verbose=False)¶
- Bases: - object- A class to control and run unit tests. - This class is unchanged from previous versions of sconsUtils, but it will now generally be called via - lsst.sconsUtils.scripts.BasicSConscript.tests.- Parameters:
- envSCons.Environment
- An SCons Environment (almost always - lsst.sconsUtils.env).
- ignoreListlist, optional
- A list of tests that should NOT be run — useful in conjunction with glob patterns. If a file is listed as “@fileName”, the @ is stripped and we don’t bother to check if fileName exists (useful for machine-generated files). 
- expectedFailuresdict, optional
- A dictionary; the keys are tests that are known to fail; the values are strings to print. 
- argsdict, optional
- A dictionary with testnames as keys, and argument strings as values. As scons always runs from the top-level directory, tests has to fiddle with paths. If an argument is a file this is done automatically; if it’s e.g., just a basename then you have to tell tests that it’s really (part of a) filename by prefixing the name by - file:.
- tmpDirstr, optional
- The location of the test outputs. 
- verbosebool, optional
- How chatty you want the test code to be. 
 
- env
 - Notes - Sample usage: - tests = lsst.tests.Control( env, args={ "MaskIO_1" : "data/871034p_1_MI_msk.fits", "MaskedImage_1" : "file:data/871034p_1_MI foo", }, ignoreList=["Measure_1"], expectedFailures={"BBox_1": "Problem with single-pixel BBox"} ) - This class is unchanged from previous versions of sconsUtils, but it will now generally be called via - lsst.sconsUtils.scripts.BasicSConscript.tests.- Methods Summary - args(test)- Arguments to use for this test. - ignore(test)- Should the test be ignored. - Calculate the prefix to use for the JUnit output. - messages(test)- Return the messages to be used in case of success/failure. - run(fileGlob)- Create a test target for each file matching the supplied glob. - Add a target for running the python linter. - runPythonTests(pyList)- Add a single target for testing all python files. - Methods Documentation - args(test)¶
- Arguments to use for this test. 
 - ignore(test)¶
- Should the test be ignored. 
 - junitPrefix()¶
- Calculate the prefix to use for the JUnit output. - Returns:
- prefixstr
- Prefix string to use. 
 
- prefix
 - Notes - Will use the EUPS product being built and the value of the - LSST_JUNIT_PREFIXenvironment variable if that is set.
 - messages(test)¶
- Return the messages to be used in case of success/failure. 
 - run(fileGlob)¶
- Create a test target for each file matching the supplied glob. - Parameters:
- fileGlobstrorSCons.Environment.Glob
- File matching glob. 
 
- fileGlob
- Returns:
- targets
- Test target for each matching file. 
 
 
 - runPythonLinter()¶
- Add a target for running the python linter. - Returns:
- targetlist
- Returns a list containing a single target. Can be empty if no suitable linter configuration was found. 
 
- target
 
 - runPythonTests(pyList)¶
- Add a single target for testing all python files. - Parameters:
- pyListlist
- A list of nodes corresponding to python test files. The IgnoreList is respected when scanning for entries. If pyList is - None, or an empty list, it uses automated test discovery within pytest. This differs from the behavior of- lsst.sconsUtils.BasicSconscript.testswhere a distinction is made.
 
- pyList
- Returns:
- targetlist
- Returns a list containing a single target. 
 
- target