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