Esempio n. 1
0
 def _restoreColor(self):
     """Unfortunately other programs (that we test) can mess with termstyle's
     global settings, so we need to reset termstyle to the correct mode after
     each test (which I think is faster than just checking whether it matches
     the current mode...)
     """
     if self.termcolor:
         termstyle.enable()
     else:
         termstyle.disable()
Esempio n. 2
0
 def _restoreColor(self):
     """
     Unfortunately other programs (that we test) can mess with termstyle's
     global settings, so we need to reset termstyle to the correct mode after
     each test (which I think is faster than just checking whether it matches
     the current mode...)
     """
     if self.termcolor:
         termstyle.enable()
     else:
         termstyle.disable()
Esempio n. 3
0
def get_cmd(args):
    entry = pybib.get_bibtex(args.DOI)

    termstyle.disable()
    print(entry)
    termstyle.enable()
Esempio n. 4
0
## import sys
## sys.path.insert(0, mod_path)
## print sys.path

from subprocess import Popen, PIPE

import re




from pydflatex import Runner, Cleaner, LaTeXError, LogProcessor, Typesetter
from pydflatex.latex_logger import LaTeXLoggerColour

import termstyle
termstyle.enable()
colours = dict([(style, LaTeXLoggerColour.styled('', style)[:-8]) for style in LaTeXLoggerColour.colours])

class Harness(unittest.TestCase):


	def setup_logger(self):
		import logging
		self.logfile = tempfile.NamedTemporaryFile()
		self.handler = logging.FileHandler(self.logfile.name)
		self.t.logger = self.t.setup_logger([self.handler])

	def typeset(self, file_name, with_binary=False, ):
		tex_path = os.path.join(latex_dir, file_name)
		if with_binary:
			self.output = Popen([bin_path, tex_path], stderr=PIPE).communicate()[1]