def test_errors_context(self): with self.assertRaises(AccumulatedErrors): with errors.accumulate(): self.assertEqual(errors.get_context(), None) with errors.context('foo', 1): self.assertEqual(errors.get_context(), ('foo', 1)) errors.error('a') with errors.context('bar', 2): self.assertEqual(errors.get_context(), ('bar', 2)) errors.error('b') self.assertEqual(errors.get_context(), ('foo', 1)) errors.error('c') self.assertEqual(self.get_output(), [ 'Error: foo:1: a', 'Error: bar:2: b', 'Error: foo:1: c', ])
def test_errors_context(self): with self.assertRaises(AccumulatedErrors): with errors.accumulate(): self.assertEqual(errors.get_context(), None) with errors.context("foo", 1): self.assertEqual(errors.get_context(), ("foo", 1)) errors.error("a") with errors.context("bar", 2): self.assertEqual(errors.get_context(), ("bar", 2)) errors.error("b") self.assertEqual(errors.get_context(), ("foo", 1)) errors.error("c") self.assertEqual( self.get_output(), [ "Error: foo:1: a", "Error: bar:2: b", "Error: foo:1: c", ], )
def add_manifest(self, *args): self._log(errors.get_context(), 'add_manifest', *args)
def add_base(self, *args): self._log(errors.get_context(), 'add_base', *args)
def remove(self, section, path): self._log(errors.get_context(), 'remove', section, path)
def add(self, section, path): self._log(errors.get_context(), 'add', section, path)
def append(self, function, *args): deque.append(self, (errors.get_context(), function, args))
def remove(self, component, path): self._log(errors.get_context(), 'remove', repr(component), path)
def add(self, *args): self._log(errors.get_context(), 'add', *args)
def add_interfaces(self, *args): self._log(errors.get_context(), 'add_interfaces', *args)
def add(self, component, path): self._log(errors.get_context(), 'add', repr(component), path)