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