Changes between Version 4 and Version 5 of DevelopmentPage/CodeTesting


Ignore:
Timestamp:
Nov 29, 2012, 4:59:52 PM (12 years ago)
Author:
Valentin Hirschi
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DevelopmentPage/CodeTesting

    v4 v5  
    5757In order to do so, you simply have to create a new class in the 'unit_tests' or 'parallel_tests' directory which inherits from 'IOTests.IOTestManager' only. Then you should use the 'setUp' function to add your IOTest with the function 'self.addIOTest(folderName,testName,IOTest)' where folderName and testName are two strings identifying the test and specifying where the reference files are placed in tests/input_files/IOTestsComparison. The last argument IOTest must be an instance of the class IOTests.IOTest. This IOTest class is designed for the creation of a loop process and its output whose files are used for comparison. Of course, you are free to define your own IOTest, inheriting from IOTests.IOTest, and overloading its parameters and the function run() which specifies how the files are generated. Notice however that its attribute 'testedFiles' must be specified. It is a list of the path (relative to the path returned by the run() function) of files to be used as a reference. Notice that for each element of this list you can use regular expressions. On top of this you can prepend '-' to an explicit file name to veto it from the list of files considered (could be done with regexps, but it is simpler like this). Here is an example of how one can define the 'testedFiles'
    5858
    59 '''testedFiles = ['../../Source/MODEL/[.+\.(f|inc)]','-../../Source/MODEL/lha_read.f','-../../Source/MODEL/param_read.inc',]'''
     59'''testedFiles = ['../../Source/MODEL/[.+\.(f|inc)]','-../../Source/MODEL/lha_read.f','-../../Source/MODEL/param_read.inc']'''
    6060  => Consider all files with the extension .f or .inc in the folder '../../Source/MODEL' relative to the path output by the run() function, but vetoing the files 'param_read.inc' and 'lha_read.f'. Notice that regular expressions cannot be used in conjunction with the '-' prepend syntax.
    6161