The SKIRT project
advanced radiative transfer for astrophysics
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

 __init__ (self, subSuite=".", *, suitePath=None)
 The first argument accepted by the constructor indicates the selection of functional tests to be performed:
 clean (self)
 This function prepares the contents of all test case directories in the sub-suite for performing the tests.
 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.
 perform (self, *, skirtPath=None, visual=None)
 This function performs all tests in the test suite, verifies the results, and prepares a summary test report.
 size (self)
 This function returns the number of test cases in this test suite.
 skiPaths (self)
 This function returns a list of the paths to the ski files for the test cases in this test suite.

Protected Attributes

 _skiPaths
str _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 directory with arbitrary name containing all test case files and directories, called the "case directory"; a test suite is named after this directory
  • immediately inside the case directory there is:
    • exactly one ski file with an arbitrary name (with the .ski filename extension) specifying the simulation to be performed for the test case
    • a directory named in containing the input files for the simulation, if any
    • a directory named ref containing the reference files for the test, i.e. a copy of the output files generated by a correct simulation run
    • a directory named out to receive the actual output files when the test is performed; the contents of this directory are automatically removed and recreated when running the test case
    • everything else is ignored, as long as there are no additional files with a .ski filename extension

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

  • a directory directly or indirectly containing all test cases, called the "suite directory"; a test suite is named after this directory
  • each ski file directly or indirectly contained in the suite directory defines a test case that must adhere to the description above (no other ski files in the same directory, special directories next to the ski file, etc.)

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

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

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

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

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

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

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

◆ skiPaths()

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: