Failed Conditions
Pull Request — master (#1307)
by Lasse
01:44
created

bears.tests.java.CheckstyleBearTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %
Metric Value
dl 0
loc 16
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A test_run() 0 3 1
A setUp() 0 9 1
1
import os
2
import sys
3
from queue import Queue
4
from shutil import which
5
from unittest.case import skipIf
6
7
sys.path.insert(0, ".")
8
import unittest
9
from bears.tests.LocalBearTestHelper import LocalBearTestHelper
10
from bears.java.CheckstyleBear import CheckstyleBear
11
from coalib.settings.Section import Section
12
13
14
@skipIf(which('java') is None, 'java is not installed')
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
15
class CheckstyleBearTest(LocalBearTestHelper):
16
17
    def setUp(self):
18
        self.section = Section("test section")
19
        self.uut = CheckstyleBear(self.section, Queue())
20
        self.good_file = os.path.join(os.path.dirname(__file__),
21
                                      "test_files",
22
                                      "CheckstyleGood.java")
23
        self.bad_file = os.path.join(os.path.dirname(__file__),
24
                                     "test_files",
25
                                     "CheckstyleBad.java")
26
27
    def test_run(self):
28
        self.assertLinesValid(self.uut, [], self.good_file)
29
        self.assertLinesInvalid(self.uut, [], self.bad_file)
30
31
32
if __name__ == '__main__':
33
    unittest.main(verbosity=2)
34