def test__short(self): tf1 = ShellFormatter(self.record_list, project=MockProject()) txt = tf1.short() tmpdir = tempfile.mkdtemp() with open(os.path.join(tmpdir,"test.sh"), "w") as fp: fp.write(txt) returncode, stdout, stderr = run(["sh", "-n", "test.sh"], cwd=tmpdir) # check syntax self.assertEqual(returncode, 0) shutil.rmtree(tmpdir)
def test__long(self): tf1 = LaTeXFormatter(self.record_list, project=MockProject()) txt = tf1.long() with open(os.path.join(self.tmpdir, "test.tex"), "w") as fp: fp.write(txt) if get_executable("pdflatex").path == "pdflatex": # pdflatex not found raise unittest.SkipTest("pdflatex not found") else: returncode, stdout, stderr = run(["pdflatex", "-interaction=nonstopmode", "test.tex"], cwd=self.tmpdir) # check it builds output = stdout + stderr if returncode != 0: if "not found" in output: raise unittest.SkipTest("One of the required LaTeX packages is unavailable") else: self.fail(output)
def test__long(self): tf1 = LaTeXFormatter(self.record_list, project=MockProject()) txt = tf1.long() tmpdir = tempfile.mkdtemp() with open(os.path.join(tmpdir, "test.tex"), "w") as fp: fp.write(txt) if get_executable("pdflatex").path == "pdflatex": # pdflatex not found raise unittest.SkipTest else: returncode, stdout, stderr = run(["pdflatex", "test.tex"], cwd=tmpdir) # check it builds output = stdout + stderr if returncode != 0: if "not found" in output: # one of the required LaTeX packages is unavailable raise unittest.SkipTest else: self.fail(output) shutil.rmtree(tmpdir)
def _get_version(self): returncode, output, err = run("gams file_that_doesnt_exist.gms lo=3", shell=True) return version_in_command_line_output(command_line_output=output + err)