Failed Conditions
Pull Request — master (#1182)
by Lasse
03:16 queued 01:34
created

bears.tests.coffee_script.skip_test()   A

Complexity

Conditions 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 2
dl 0
loc 8
rs 9.4286
1
import os
2
import subprocess
0 ignored issues
show
Unused Code introduced by
The import subprocess seems to be unused.
Loading history...
3
import sys
4
import unittest
5
from queue import Queue
6
from shutil import which
7
from unittest.case import skipIf
8
9
sys.path.insert(0, ".")
10
from bears.tests.LocalBearTestHelper import LocalBearTestHelper
11
from bears.coffee_script.CoffeeLintBear import CoffeeLintBear
12
from coalib.settings.Section import Section
13
14
15
@skipIf(which('coffeelint') is None, 'coffeelint is not installed')
16
class CoffeeLintBearTest(LocalBearTestHelper):
17
    def setUp(self):
18
        self.section = Section("test section")
19
        self.uut = CoffeeLintBear(self.section, Queue())
20
21
    @staticmethod
22
    def get_test_filename(basename):
23
        return os.path.join(os.path.dirname(__file__),
24
                            "test_files",
25
                            basename + ".coffee")
26
27
    def test_good(self):
28
        good_file = self.get_test_filename("good")
29
        self.assertLinesValid(self.uut, [], good_file)
30
31
    def test_warn(self):
32
        warn_file = self.get_test_filename("warning")
33
        self.assertLinesInvalid(self.uut, [], warn_file)
34
35
    def test_err(self):
36
        err_file = self.get_test_filename("error")
37
        self.assertLinesInvalid(self.uut, [], err_file)
38
39
    def test_invalid(self):
40
        # CoffeeLint will generate an invalid CSV on this one!
41
        invalid_file = self.get_test_filename("invalid")
42
        self.assertLinesInvalid(self.uut, [], invalid_file)
43
44
45
if __name__ == '__main__':
46
    unittest.main(verbosity=2)
47