The SKIRT project
advanced radiative transfer for astrophysics
Public Member Functions | Private Attributes | List of all members
pts.test.functional.SkirtTestSuite Class Reference

An instance of the SkirtTestSuite class represents a suite of SKIRT test cases, stored as a nested structure of files and directories according to a specific layout, and provides facilities to perform the tests, verify the results, and prepare a summary test report. More...

Public Member Functions

def __init__ (self, subSuite=".", *suitePath=None)
 The first argument accepted by the constructor indicates the selection of functional tests to be performed: More...
 
def clean (self)
 This function prepares the contents of all test case directories in the sub-suite for performing the tests. More...
 
def endorse (self)
 This function "endorses" the current output of all test case directories in the sub-suite by replacing the contents of the "ref" directory by the contents of the "out" directory. More...
 
def perform (self, *skirtPath=None, visual=None)
 This function performs all tests in the test suite, verifies the results, and prepares a summary test report. More...
 
def size (self)
 This function returns the number of test cases in this test suite. More...
 
def skiPaths (self)
 This function returns a list of the paths to the ski files for the test cases in this test suite. More...
 

Private Attributes

 _skiPaths
 
 _suitePath
 

Detailed Description

An instance of the SkirtTestSuite class represents a suite of SKIRT test cases, stored as a nested structure of files and directories according to a specific layout, and provides facilities to perform the tests, verify the results, and prepare a summary test report.

A test suite consists of a set of independent test cases (i.e. test cases can be executed in arbitrary order)

Each test case in a test suite is defined by a collection of files and directories as follows:

A test suite is defined by a collection of files and directories as follows:

For example, a test suite may be structured with nested sub-suites as follows (where each CaseN directory contains a ski file plus ref, in, and out directories):

 SKIRT Tests
   SPH simulations
       Case1
       Case2
   Geometries
     Radial
         Case1
         Case2
     Cylindrical
         Case1
         Case2
         Case3
     Full 3D
         Case1
         Case2
   Instruments

It is also allowed to nest test cases inside another test case, but this is not recommended.

Constructor & Destructor Documentation

◆ __init__()

def pts.test.functional.SkirtTestSuite.__init__ (   self,
  subSuite = ".",
suitePath = None 
)

The first argument accepted by the constructor indicates the selection of functional tests to be performed:

  • "." (a single period): perform all test cases in the standard suite.
  • "testcase" (the name of a test case directory): perform all test cases with that name.
  • "subsuite" (the name of an intermediate directory in the hierarchy): perform the test cases in all sub-suites with that name.
  • "parentsubsuite/testcase" or "parentsubsuite/subsuite": perform the indicated test case(s) or sub-suite(s) that reside immediately inside the indicated parent sub-suite; this can disambiguate items with the same name.

In addition, the constructor accepts an optional argument specifying the path of the directory containing the complete functional test suite. If specified, the path is interpreted as described for the pts.utils.absPath() function. If omitted, the default path is pts.utils.projectParentPath()/"Functional9".

Member Function Documentation

◆ clean()

def pts.test.functional.SkirtTestSuite.clean (   self)

This function prepares the contents of all test case directories in the sub-suite for performing the tests.

Specifically, it creates in, out and ref directories next to the ski file, if they don't exist, and it removes all files from the out directory (without touching any of its subdirectories, which should not be present anyway).

◆ endorse()

def pts.test.functional.SkirtTestSuite.endorse (   self)

This function "endorses" the current output of all test case directories in the sub-suite by replacing the contents of the "ref" directory by the contents of the "out" directory.

Note
This function destroys the current reference output for test cases; USE WITH CARE!

◆ perform()

def pts.test.functional.SkirtTestSuite.perform (   self,
skirtPath = None,
  visual = None 
)

This function performs all tests in the test suite, verifies the results, and prepares a summary test report.

The function accepts two optional arguments:

  • skirtPath: the path to the skirt executable. If specified, the path is interpreted as described for the pts.utils.absPath() function. If omitted, the default path is used as described for the constructor of the pts.simulation.skirt.Skirt class.
  • visual: a string describing the visualizations to be created for the output of each test case, if any. If specified, the string is a semicolon-separated list of PTS visualization commands as they would be entered at the command line, omitting the simulation output path argument (which will be inserted automatically).

◆ size()

def pts.test.functional.SkirtTestSuite.size (   self)

This function returns the number of test cases in this test suite.

◆ skiPaths()

def pts.test.functional.SkirtTestSuite.skiPaths (   self)

This function returns a list of the paths to the ski files for the test cases in this test suite.


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