diff options
author | Matth?us G. Chajdas <dev@anteru.net> | 2019-11-10 13:56:53 +0100 |
---|---|---|
committer | Matth?us G. Chajdas <dev@anteru.net> | 2019-11-10 13:56:53 +0100 |
commit | 1dd3124a9770e11b6684e5dd1e6bc15a0aa3bc67 (patch) | |
tree | 87a171383266dd1f64196589af081bc2f8e497c3 /tests/test_latex_formatter.py | |
parent | f1c080e184dc1bbc36eaa7cd729ff3a499de568a (diff) | |
download | pygments-master.tar.gz |
Diffstat (limited to 'tests/test_latex_formatter.py')
-rw-r--r-- | tests/test_latex_formatter.py | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/tests/test_latex_formatter.py b/tests/test_latex_formatter.py deleted file mode 100644 index aa4ac3bb..00000000 --- a/tests/test_latex_formatter.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -""" - Pygments LaTeX formatter tests - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" - -from __future__ import print_function - -import os -import unittest -import tempfile - -from pygments.formatters import LatexFormatter -from pygments.lexers import PythonLexer - -import support - -TESTFILE, TESTDIR = support.location(__file__) - - -class LatexFormatterTest(unittest.TestCase): - - def test_valid_output(self): - with open(TESTFILE) as fp: - tokensource = list(PythonLexer().get_tokens(fp.read())) - fmt = LatexFormatter(full=True, encoding='latin1') - - handle, pathname = tempfile.mkstemp('.tex') - # place all output files in /tmp too - old_wd = os.getcwd() - os.chdir(os.path.dirname(pathname)) - tfile = os.fdopen(handle, 'wb') - fmt.format(tokensource, tfile) - tfile.close() - try: - import subprocess - po = subprocess.Popen(['latex', '-interaction=nonstopmode', - pathname], stdout=subprocess.PIPE) - ret = po.wait() - output = po.stdout.read() - po.stdout.close() - except OSError as e: - # latex not available - raise support.SkipTest(e) - else: - if ret: - print(output) - self.assertFalse(ret, 'latex run reported errors') - - os.unlink(pathname) - os.chdir(old_wd) |