def setUp(self): self.doc_dir = "docs" self.temp_dir = TempDir() self.data_dir = DataDir("unittest") self.origin_path = self.data_dir.get_path("small_testfile.py") self.destination_path = self.temp_dir.get_path("small_testfile.py") shutil.copyfile(self.origin_path, self.destination_path)
def check(self, fname, tokens=None): data_dir = DataDir("test") fname = data_dir.get_path(fname) try: text = antiweb.generate(fname, tokens, True) except antiweb.WebError as e: return e.error_list, [] output = os.path.splitext(fname)[0] + ".rst" try: with open(output, "r") as f: cmp_text = f.read() return cmp_text, text except IOError: with open(output, "w") as f: f.write(text) return text, text