class CorrectionBasedBearTest(LocalBearTestHelper):
    """
    This test only covers corner cases. The basic functionality is tested in
    a more intuitive way in the IndentBearTest.
    """
    def setUp(self):
        self.section = Section('')
        self.queue = Queue()
        self.uut = IndentBear(self.section, self.queue)

    def test_errors(self):
        old_binary, self.uut.executable = self.uut.executable, "invalid_"
        "stuff_here"

        self.uut.execute(filename='', file=[])
        self.queue.get()
        self.assertRegex(str(self.queue.get()), r'\[WARNING\] .*')

        self.uut.executable = old_binary

    def test_missing_binary(self):
        old_binary = IndentBear.executable
        IndentBear.executable = "fdgskjfdgjdfgnlfdslk"

        self.assertEqual(IndentBear.check_prerequisites(),
                         "'fdgskjfdgjdfgnlfdslk' is not installed.")

        # "echo" is existent on nearly all platforms.
        IndentBear.executable = "echo"
        self.assertTrue(IndentBear.check_prerequisites())

        del IndentBear.executable
        self.assertTrue(IndentBear.check_prerequisites())

        IndentBear.executable = old_binary
class CorrectionBasedBearTest(LocalBearTestHelper):
    """
    This test only covers corner cases. The basic functionality is tested in
    a more intuitive way in the IndentBearTest.
    """

    def setUp(self):
        self.section = Section('')
        self.queue = Queue()
        self.uut = IndentBear(self.section, self.queue)

    def test_errors(self):
        old_binary, self.uut.BINARY = self.uut.BINARY, "invalid_stuff_here"

        self.uut.execute(filename='', file=[])
        self.queue.get()
        self.assertRegex(str(self.queue.get()), r'\[WARNING\] .*')

        self.uut.BINARY = old_binary

    def test_missing_binary(self):
        old_binary = IndentBear.BINARY
        IndentBear.BINARY = "fdgskjfdgjdfgnlfdslk"

        self.assertEqual(IndentBear.check_prerequisites(),
                         "'fdgskjfdgjdfgnlfdslk' is not installed.")

        # "echo" is existent on nearly all platforms.
        IndentBear.BINARY = "echo"
        self.assertTrue(IndentBear.check_prerequisites())

        del IndentBear.BINARY
        self.assertTrue(IndentBear.check_prerequisites())

        IndentBear.BINARY = old_binary
Beispiel #3
0
    def test_missing_binary(self):
        old_binary = IndentBear.executable
        IndentBear.executable = "fdgskjfdgjdfgnlfdslk"

        self.assertEqual(IndentBear.check_prerequisites(),
                         "'fdgskjfdgjdfgnlfdslk' is not installed.")

        # "echo" is existent on nearly all platforms.
        IndentBear.executable = "echo"
        self.assertTrue(IndentBear.check_prerequisites())

        del IndentBear.executable
        self.assertTrue(IndentBear.check_prerequisites())

        IndentBear.executable = old_binary
    def test_missing_binary(self):
        old_binary = IndentBear.executable
        IndentBear.executable = "fdgskjfdgjdfgnlfdslk"

        self.assertEqual(IndentBear.check_prerequisites(),
                         "'fdgskjfdgjdfgnlfdslk' is not installed.")

        # "echo" is existent on nearly all platforms.
        IndentBear.executable = "echo"
        self.assertTrue(IndentBear.check_prerequisites())

        del IndentBear.executable
        self.assertTrue(IndentBear.check_prerequisites())

        IndentBear.executable = old_binary
class CorrectionBasedBearTest(LocalBearTestHelper):
    """
    This test only covers corner cases. The basic functionality is tested in
    a more intuitive way in the IndentBearTest.
    """

    def setUp(self):
        self.section = Section('')
        self.queue = Queue()
        self.uut = IndentBear(self.section, self.queue)

    def test_errors(self):
        old_binary, self.uut.BINARY = self.uut.BINARY, "invalid_stuff_here"

        self.uut.execute(filename='', file=[])
        self.queue.get()
        self.assertRegex(str(self.queue.get()), r'\[WARNING\] .*')

        self.uut.BINARY = old_binary
 def setUp(self):
     self.section = Section('')
     self.queue = Queue()
     self.uut = IndentBear(self.section, self.queue)
Beispiel #7
0
 def setUp(self):
     self.section = Section('name')
     self.section.append(Setting("use_spaces", "true"))
     self.section.append(Setting("max_line_length", "80"))
     self.uut = IndentBear(self.section, Queue())
 def setUp(self):
     self.section = Section('')
     self.queue = Queue()
     self.uut = IndentBear(self.section, self.queue)