Ejemplo n.º 1
0
 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',
     ])
Ejemplo n.º 2
0
 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",
         ],
     )
Ejemplo n.º 3
0
 def add_manifest(self, *args):
     self._log(errors.get_context(), 'add_manifest', *args)
Ejemplo n.º 4
0
 def add_base(self, *args):
     self._log(errors.get_context(), 'add_base', *args)
Ejemplo n.º 5
0
 def remove(self, section, path):
     self._log(errors.get_context(), 'remove', section, path)
Ejemplo n.º 6
0
 def add(self, section, path):
     self._log(errors.get_context(), 'add', section, path)
Ejemplo n.º 7
0
 def append(self, function, *args):
     deque.append(self, (errors.get_context(), function, args))
Ejemplo n.º 8
0
 def remove(self, component, path):
     self._log(errors.get_context(), 'remove', repr(component), path)
Ejemplo n.º 9
0
 def add(self, section, path):
     self._log(errors.get_context(), 'add', section, path)
Ejemplo n.º 10
0
 def add(self, *args):
     self._log(errors.get_context(), 'add', *args)
Ejemplo n.º 11
0
 def add_interfaces(self, *args):
     self._log(errors.get_context(), 'add_interfaces', *args)
Ejemplo n.º 12
0
 def add_manifest(self, *args):
     self._log(errors.get_context(), 'add_manifest', *args)
Ejemplo n.º 13
0
 def add_base(self, *args):
     self._log(errors.get_context(), 'add_base', *args)
Ejemplo n.º 14
0
 def remove(self, section, path):
     self._log(errors.get_context(), 'remove', section, path)
Ejemplo n.º 15
0
 def add_interfaces(self, *args):
     self._log(errors.get_context(), 'add_interfaces', *args)
Ejemplo n.º 16
0
 def add(self, component, path):
     self._log(errors.get_context(), 'add', repr(component), path)
Ejemplo n.º 17
0
 def add(self, *args):
     self._log(errors.get_context(), 'add', *args)
Ejemplo n.º 18
0
 def append(self, function, *args):
     deque.append(self, (errors.get_context(), function, args))