Exemple #1
0
    def __init__(self, testingDirectory='', dataSetDirectory='', debug=False):
        # keep data containers in this base class as some are used in the functions of this class.
        self._tests = []  # list of test objects
        self._testNames = {}  # dict of test file names (a list of names per component)
        self._testParamValues = {}
        self._generateOriginals = False  # bool for generating original data set
        self._debug = debug

        # create testing directory
        if not isinstance(testingDirectory, _np.str):
            raise TypeError("Testing directory is not a string")
        else:
            if testingDirectory == '':
                pass
            elif _os.getcwd().split('/')[-1] == testingDirectory:
                pass
            # check for directory and make it if not:
            elif _os.path.exists(testingDirectory):
                _os.chdir(testingDirectory)
            elif not _os.path.exists(testingDirectory):
                _os.system("mkdir " + testingDirectory)
                _os.chdir(testingDirectory)

        # make dirs for gmad files, results, bdsim output, and failed outputs
        if not _os.path.exists('Tests'):
            _os.system("mkdir Tests")
        if not _os.path.exists('Results'):
            _os.system("mkdir Results")
        if not _os.path.exists('BDSIMOutput'):
            _os.system("mkdir BDSIMOutput")
        _os.chdir('BDSIMOutput')
        if not _os.path.exists('FailedTests'):
            _os.system("mkdir FailedTests")
        _os.chdir('../')

        # set directory of existing data set that the tests will be compared to
        self._dataSetDirectory = ''
        if isinstance(dataSetDirectory, _np.str):
            self._dataSetDirectory = dataSetDirectory

        self.Analysis = TestResults.Analysis()  # results instance