def __init__(self): self._enabled = True self._log = "" if is_casapy(): from taskinit import casalog self.logger = casalog else: self.logger = LogSink() set_global_sink(self.logger)
import sys import os from nose.tools import * from nose.plugins.skip import Skip, SkipTest from asap.logging import asaplog from asap.env import is_casapy from asap import rcParams # no logging if not verbose rcParams['verbose'] = True if is_casapy(): raise SkipTest("Can't test against casalog") class WritableObject: def __init__(self): self.content = [] def write(self, string): self.content.append(string) def clear(self): self.content = [] stdout_redirect = WritableObject() def redirect_setup(): sys.stdout = stdout_redirect def redirect_teardown():