lsst.sconsUtils  16.0-12-gb2cbfd6
Public Member Functions | Public Attributes | List of all members
lsst.sconsUtils.tests.Control Class Reference

A class to control unit tests. More...

Public Member Functions

def __init__ (self, env, ignoreList=None, expectedFailures=None, args=None, tmpDir=".tests", verbose=False)
 Create an object to run tests. More...
 
def args (self, test)
 
def ignore (self, test)
 
def messages (self, test)
 
def run (self, fileGlob)
 
def runPythonTests (self, pyList)
 
def junitPrefix (self)
 

Public Attributes

 runExamples
 

Detailed Description

A class to control unit tests.

This class is unchanged from previous versions of sconsUtils, but it will now generally be called via scripts.BasicSConscript.tests().

Constructor & Destructor Documentation

◆ __init__()

def lsst.sconsUtils.tests.Control.__init__ (   self,
  env,
  ignoreList = None,
  expectedFailures = None,
  args = None,
  tmpDir = ".tests",
  verbose = False 
)

Create an object to run tests.

Parameters
envAn SCons Environment (almost always lsst.sconsUtils.env).
ignoreListA 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).
expectedFaluresA dictionary; the keys are tests that are known to fail; the values are strings to print.
argsA 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:".
tmpDirThe location of the test outputs.
verboseHow chatty you want the test code to be.
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"}
)

References lsst.sconsUtils.tests.Control._args, lsst.sconsUtils.tests.Control._cwd, lsst.sconsUtils.tests.Control._env, lsst.sconsUtils.tests.Control._EXPECT_FAILURE, lsst.sconsUtils.tests.Control._IGNORE, lsst.sconsUtils.tests.Control._info, lsst.sconsUtils.tests.Control._tmpDir, lsst.sconsUtils.tests.Control._tmpDirAbs, and lsst.sconsUtils.tests.Control._verbose.

Member Function Documentation

◆ args()

def lsst.sconsUtils.tests.Control.args (   self,
  test 
)

References lsst.sconsUtils.tests.Control._args.

Referenced by lsst.sconsUtils.tests.Control.run().

◆ ignore()

def lsst.sconsUtils.tests.Control.ignore (   self,
  test 
)

References lsst.sconsUtils.tests.Control._env, lsst.sconsUtils.tests.Control._IGNORE, lsst.sconsUtils.tests.Control._info, and lsst.sconsUtils.tests.Control._verbose.

Referenced by lsst.sconsUtils.tests.Control.run(), and lsst.sconsUtils.tests.Control.runPythonTests().

◆ junitPrefix()

def lsst.sconsUtils.tests.Control.junitPrefix (   self)

References lsst.sconsUtils.tests.Control._env, and lsst.sconsUtils.tests.Control._tmpDirAbs.

Referenced by lsst.sconsUtils.tests.Control.run(), and lsst.sconsUtils.tests.Control.runPythonTests().

◆ messages()

def lsst.sconsUtils.tests.Control.messages (   self,
  test 
)
Return the messages to be used in case of success/failure; the logicals
(note that they are strings) tell whether the test is expected to pass

References lsst.sconsUtils.tests.Control._EXPECT_FAILURE, and lsst.sconsUtils.tests.Control._info.

Referenced by lsst.sconsUtils.tests.Control.run().

◆ run()

def lsst.sconsUtils.tests.Control.run (   self,
  fileGlob 
)
Create a test target for each file matching the supplied glob.

References lsst.sconsUtils.tests.Control._cwd, lsst.sconsUtils.tests.Control._env, lsst.sconsUtils.tests.Control._getPytestCoverageCommand(), lsst.sconsUtils.tests.Control._tmpDir, lsst.sconsUtils.tests.Control.args(), lsst.sconsUtils.tests.Control.ignore(), lsst.sconsUtils.tests.Control.junitPrefix(), lsst.sconsUtils.tests.Control.messages(), and lsst.sconsUtils.tests.Control.runExamples.

◆ runPythonTests()

def lsst.sconsUtils.tests.Control.runPythonTests (   self,
  pyList 
)
Add a single target for testing all python files. pyList is
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 scripts.tests()
where a distinction is made. Returns a list containing a single
target.

References lsst.sconsUtils.tests.Control._cwd, lsst.sconsUtils.tests.Control._env, lsst.sconsUtils.tests.Control._getPytestCoverageCommand(), lsst.sconsUtils.tests.Control._tmpDir, lsst.sconsUtils.tests.Control.ignore(), and lsst.sconsUtils.tests.Control.junitPrefix().

Member Data Documentation

◆ runExamples

lsst.sconsUtils.tests.Control.runExamples

The documentation for this class was generated from the following file: