Exemplo n.º 1
0
 def test_debug_run_with_no_return(self, runcall):
     section = Section('name')
     section.append(Setting('debug_bears', 'True'))
     my_bear = Bear(section, self.queue)
     args = ()
     kwargs = {}
     self.assertIsNone(my_bear.run_bear_from_section(args, kwargs))
Exemplo n.º 2
0
 def __init__(self,
              file_dict,  # filename : file contents
              section,
              message_queue,
              timeout=0):
     Bear.__init__(self, section, message_queue, timeout)
     self.file_dict = file_dict
Exemplo n.º 3
0
 def __init__(self,
              file_dict,  # filename : file contents
              section,
              message_queue,
              TIMEOUT=0):
     Bear.__init__(self, section, message_queue, TIMEOUT)
     self.file_dict = file_dict
Exemplo n.º 4
0
    def test_simple_api(self):
        self.assertRaises(TypeError, TestBear, self.settings, 2)
        self.assertRaises(TypeError, TestBear, None, self.queue)
        self.assertRaises(NotImplementedError, self.uut.kind)

        base = Bear(self.settings, None)
        self.assertRaises(NotImplementedError, base.run)
        self.assertEqual(base.get_non_optional_settings(), {})
Exemplo n.º 5
0
    def test_dependencies(self):
        self.assertEqual(Bear.get_dependencies(), [])
        self.assertEqual(Bear.missing_dependencies([]), [])
        self.assertEqual(Bear.missing_dependencies([BadTestBear]), [])

        self.assertEqual(TestBear.missing_dependencies([]), [BadTestBear])
        self.assertEqual(TestBear.missing_dependencies([BadTestBear]), [])
        self.assertEqual(TestBear.missing_dependencies([TestBear]), [BadTestBear])
        self.assertEqual(TestBear.missing_dependencies([TestBear, BadTestBear]), [])
Exemplo n.º 6
0
    def test_dependencies(self):
        self.assertEqual(Bear.BEAR_DEPS, set())
        self.assertEqual(Bear.missing_dependencies([]), set())
        self.assertEqual(Bear.missing_dependencies([BadTestBear]), set())

        self.assertEqual(TestBear.missing_dependencies([]), {BadTestBear})
        self.assertEqual(TestBear.missing_dependencies([BadTestBear]), set())
        self.assertEqual(TestBear.missing_dependencies([TestBear]),
                         {BadTestBear})
        self.assertEqual(TestBear.missing_dependencies([TestBear,
                                                        BadTestBear]),
                         set())
Exemplo n.º 7
0
    def __init__(self,
                 file_dict,
                 section,
                 message_queue,
                 timeout=0):
        """
        Constructs a new GlobalBear.

        :param file_dict: The dictionary of {filename: file contents}.

        See :class:`coalib.bears.Bear` for other parameters.
        """
        Bear.__init__(self, section, message_queue, timeout)
        self.file_dict = file_dict
Exemplo n.º 8
0
    def test_methods_available(self):
        # these should be available and not throw anything
        base = Bear(self.settings, None)
        base.set_up()
        base.tear_down()

        self.assertRaises(NotImplementedError, base.run)

        self.assertEqual(base.get_non_optional_settings(), {})
Exemplo n.º 9
0
 def test_new_result(self):
     bear = Bear(self.settings, None)
     result = bear.new_result('test message', '/tmp/testy')
     expected = Result.from_values(bear, 'test message', '/tmp/testy')
     self.assertEqual(result, expected)
Exemplo n.º 10
0
 def __init__(self,
              section,
              message_queue,
              TIMEOUT=0):
     Bear.__init__(self, section, message_queue, TIMEOUT)
Exemplo n.º 11
0
 def __init__(self, section, queue, error_message):
     Bear.__init__(self, section, queue)
     self.error_message = error_message
Exemplo n.º 12
0
 def __init__(self, section, queue, timeout=0.1):
     Bear.__init__(self, section, queue, timeout)
 def __init__(self, section, queue):
     Bear.__init__(self, section, queue)
Exemplo n.º 14
0
 def __init__(self):
     Bear.__init__(self, Section("settings"), multiprocessing.Queue())
Exemplo n.º 15
0
 def __init__(self, section, queue):
     Bear.__init__(self, section, queue)
     self.was_executed = False
Exemplo n.º 16
0
 def test_custom_continue(self, do_continue):
     section = Section('name')
     bear = Bear(section, self.queue, debugger=True)
     args = ()
     self.assertEqual(Debugger(bear).do_quit(args), 1)
     pdb.Pdb.do_continue.assert_called_once_with(args)
Exemplo n.º 17
0
 def __init__(self):
     Bear.__init__(self, Section("settings"), multiprocessing.Queue())
Exemplo n.º 18
0
 def __init__(self, *args, **kwargs):
     Bear.__init__(self, *args, **kwargs)
Exemplo n.º 19
0
 def __init__(self, section, queue):
     Bear.__init__(self, section, queue)
     self.was_executed = False
Exemplo n.º 20
0
 def __init__(self, section, queue, timeout=0.1):
     Bear.__init__(self, section, queue, timeout)
Exemplo n.º 21
0
 def test_debug_run_with_no_return(self, runcall):
     section = Section('name')
     my_bear = Bear(section, self.queue, debugger=True)
     args = ()
     kwargs = {}
     self.assertIsNone(my_bear.run_bear_from_section(args, kwargs))
Exemplo n.º 22
0
 def __init__(self, *args, **kwargs):
     Bear.__init__(self, *args, **kwargs)
Exemplo n.º 23
0
 def __init__(self, section, queue, error_message):
     Bear.__init__(self, section, queue)
     self.error_message = error_message
Exemplo n.º 24
0
 def __init__(self, section, queue):
     Bear.__init__(self, section, queue)
Exemplo n.º 25
0
 def __init__(self, section, message_queue, TIMEOUT=0):
     Bear.__init__(self, section, message_queue, TIMEOUT)
Exemplo n.º 26
0
 def __init__(self, section, queue, prerequisites_fulfilled):
     BearWithPrerequisites.prerequisites_fulfilled = prerequisites_fulfilled
     Bear.__init__(self, section, queue)
     self.was_executed = False
Exemplo n.º 27
0
 def __init__(self, section, queue, prerequisites_fulfilled):
     BearWithPrerequisites.prerequisites_fulfilled = prerequisites_fulfilled
     Bear.__init__(self, section, queue)
     self.was_executed = False
Exemplo n.º 28
0
 def __init__(self,
              section,
              message_queue,
              timeout=0):
     Bear.__init__(self, section, message_queue, timeout)
Exemplo n.º 29
0
 def test_new_result(self):
     bear = Bear(self.settings, None)
     result = bear.new_result('test message', '/tmp/testy')
     expected = Result.from_values(bear, 'test message', '/tmp/testy')
     self.assertEqual(result, expected)