def testMain(self): self.removeTarget() path = self._trg + self._lastNode + os.sep if not os.path.exists(path): os.makedirs(path) fn = path + 'mustBeDeleted.dat'; self.mkFile(fn, 'yes') argv=[ # "testprog", "-a", "-c", self._configFile, "-l", self._logFile, "--delete", "-m", "3", "-p", "*,-*.bak", "-s", "-u", "-vv", self._src, self._trg ] self.assertEquals(0, main(argv)) self.assertFalse(os.path.exists(fn)) argv=[ # "testprog", "--add", "--config=" + self._configFile, "--delete", "--log-file=" + self._logFile, "--node-patterns", "*,-*.bak", "--dir-patterns", "*,-tmp,-temp,-cache", "--max-depth=3", "--size", "--update", "--use-last-node", "--verbose", self._src, self._trg ] self.assertEquals(0, main(argv))
def testMainExit(self): argv=[ # "testprog", "--add", "--config=" + self._configFile, "--delete", "--log-file=" + self._logFile, "--node-patterns", "*,-*.bak", "--dir-patterns", "*,-tmp,-temp,-cache", "--max-depth=3", "--report", "--size", "--update", "--use-last-node", "--verbose", self._src, self._trg ] try: self.assertEquals(0, main(argv)) self.fail('report without browser') except SystemExit: pass