Ejemplo n.º 1
0
 def setUp(self):
     super(LoggingCatcher, self).setUp()
     self.threshold = log.set_threshold(FATAL)
     # when log is replaced by logging we won't need
     # such monkey-patching anymore
     self._old_log = log.Log._log
     log.Log._log = self._log
     self.logs = []
Ejemplo n.º 2
0
 def setUp(self):
     super(LoggingSilencer, self).setUp()
     self.threshold = log.set_threshold(log.FATAL)
     # catching warnings
     # when log will be replaced by logging
     # we won't need such monkey-patch anymore
     self._old_log = log.Log._log
     log.Log._log = self._log
     self.logs = []
Ejemplo n.º 3
0
    def setUp(self):
        """Patches the environment."""
        super(PyPIRCCommandTestCase, self).setUp()
        self.tmp_dir = self.mkdtemp()
        os.environ['HOME'] = self.tmp_dir
        self.rc = os.path.join(self.tmp_dir, '.pypirc')
        self.dist = Distribution()

        class command(PyPIRCCommand):
            def __init__(self, dist):
                PyPIRCCommand.__init__(self, dist)
            def initialize_options(self):
                pass
            finalize_options = initialize_options

        self._cmd = command
        self.old_threshold = set_threshold(WARN)
Ejemplo n.º 4
0
 def tearDown(self):
     log.set_threshold(self.threshold)
     log.Log._log = self._old_log
     super(LoggingCatcher, self).tearDown()
Ejemplo n.º 5
0
 def tearDown(self):
     """Removes the patch."""
     set_threshold(self.old_threshold)
     super(PyPIRCCommandTestCase, self).tearDown()