def testRunWithDiff(self): self.__outContent = "abc" with DisposableDirectory("testdir", True) as dir: runner = depthmaprunner.DepthmapRegressionRunner(lambda d, a: self.runfuncDifferentResults(d,a), "basebin", "testbin", dir.name()) (result, message) = runner.runTestCase("testname", self.makeCommand("infile.graph", "outfile.graph", "visibility")) self.assertFalse(result) self.assertEqual(message, "Test outputs differ")
def testSuccessfullRun(self): with DisposableDirectory("testdir", True) as dir: runner = depthmaprunner.DepthmapRegressionRunner( lambda d, a: self.runfuncSucceedAlwaysSame(d, a), "basebin", "testbin", dir.name()) (result, message) = runner.runTestCase( "testname", self.makeCommand("infile.graph", "outfile.graph", "visibility")) self.assertTrue(result)
def testTestRunFail(self): with DisposableDirectory("testdir", True) as dir: runner = depthmaprunner.DepthmapRegressionRunner( lambda d, a: self.runfuncFail(d, a, "testbin", True), "basebin", "testbin", dir.name()) (result, message) = runner.runTestCase( "testname", self.makeCommand("infile.graph", "outfile.graph", "visibility")) self.assertFalse(result) self.assertEqual(message, "Test run failed")
def testTestRunOutputMissing(self): with DisposableDirectory("testdir", True) as dir: runner = depthmaprunner.DepthmapRegressionRunner( lambda d, a: self.runfuncWriteNoFile(d, a, "testbin"), "basebin", "testbin", dir.name()) (result, message) = runner.runTestCase( "testname", self.makeCommand("infile.graph", "outfile.graph", "visibility")) self.assertFalse(result) self.assertEqual( message, "Test output {0} does not exist".format( os.path.join(dir.name(), "testname" + "_test", "outfile.graph")))