import unittest import utils.file_tool as t import utils.path_tool import ulrich.program class MyTestCase(unittest.TestCase): def test_getFiles(self): job = ulrich.program.Job("unit") args = {"application": "TEST", "application": "ENV01", "modus": "unit", "loglevel": "debug", "tool": "job_tool", "modus": "unit"} job.par.setParameterArgs(args) r = t.getFiles(job.m, job.conf.confs.get("paths").get("program") + "/utils", "file_.*.py", None) self.assertEqual((len(r) == 1), True) r = t.getFiles(job.m, job.conf.confs.get("paths").get("program") + "/utils", "file__.*.py", None) self.assertEqual((len(r) == 0), True) r = t.getFiles(job.m, job.conf.confs.get("paths").get("program") + "/utils", ".*_tool.py", None) self.assertEqual((len(r) > 2), True) r = t.getFilesRec(job.m, job.conf.confs.get("paths").get("program"), ".*?file.*.py") print (r) def test_pathTool(self): job = ulrich.program.Job("unit") args = {"application": "TEST", "application": "ENV01", "modus": "unit", "loglevel": "debug", "tool": "job_tool", "modus": "unit"} job.par.setParameterArgs(args) self.assertEqual(utils.path_tool.generatePath("program", "komp", "testA", "CONFIG.yml"), "/home/ulrich/6_Projekte/PythonProject/komponents/testA/COFIG.yml") if __name__ == '__main__': unittest.main()