Exemple #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))
Exemple #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
Exemple #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
Exemple #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(), {})
Exemple #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]), [])
Exemple #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())
Exemple #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
Exemple #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(), {})
Exemple #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)
Exemple #10
0
 def __init__(self,
              section,
              message_queue,
              TIMEOUT=0):
     Bear.__init__(self, section, message_queue, TIMEOUT)
Exemple #11
0
 def __init__(self, section, queue, error_message):
     Bear.__init__(self, section, queue)
     self.error_message = error_message
Exemple #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)
Exemple #14
0
 def __init__(self):
     Bear.__init__(self, Section("settings"), multiprocessing.Queue())
Exemple #15
0
 def __init__(self, section, queue):
     Bear.__init__(self, section, queue)
     self.was_executed = False
Exemple #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)
Exemple #17
0
 def __init__(self):
     Bear.__init__(self, Section("settings"), multiprocessing.Queue())
Exemple #18
0
 def __init__(self, *args, **kwargs):
     Bear.__init__(self, *args, **kwargs)
Exemple #19
0
 def __init__(self, section, queue):
     Bear.__init__(self, section, queue)
     self.was_executed = False
Exemple #20
0
 def __init__(self, section, queue, timeout=0.1):
     Bear.__init__(self, section, queue, timeout)
Exemple #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))
Exemple #22
0
 def __init__(self, *args, **kwargs):
     Bear.__init__(self, *args, **kwargs)
Exemple #23
0
 def __init__(self, section, queue, error_message):
     Bear.__init__(self, section, queue)
     self.error_message = error_message
Exemple #24
0
 def __init__(self, section, queue):
     Bear.__init__(self, section, queue)
Exemple #25
0
 def __init__(self, section, message_queue, TIMEOUT=0):
     Bear.__init__(self, section, message_queue, TIMEOUT)
Exemple #26
0
 def __init__(self, section, queue, prerequisites_fulfilled):
     BearWithPrerequisites.prerequisites_fulfilled = prerequisites_fulfilled
     Bear.__init__(self, section, queue)
     self.was_executed = False
Exemple #27
0
 def __init__(self, section, queue, prerequisites_fulfilled):
     BearWithPrerequisites.prerequisites_fulfilled = prerequisites_fulfilled
     Bear.__init__(self, section, queue)
     self.was_executed = False
Exemple #28
0
 def __init__(self,
              section,
              message_queue,
              timeout=0):
     Bear.__init__(self, section, message_queue, timeout)
Exemple #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)