Failed Conditions
Pull Request — master (#1182)
by Lasse
02:00 queued 25s
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 sys
3
import unittest
4
from queue import Queue
5
from shutil import which
6
from unittest.case import skipIf
7
8
sys.path.insert(0, ".")
9
from bears.tests.LocalBearTestHelper import LocalBearTestHelper
10
from bears.coffee_script.CoffeeLintBear import CoffeeLintBear
11
from coalib.settings.Section import Section
12
13
14
@skipIf(which('coffeelint') is None, 'coffeelint is not installed')
15
class CoffeeLintBearTest(LocalBearTestHelper):
16
    def setUp(self):
17
        self.section = Section("test section")
18
        self.uut = CoffeeLintBear(self.section, Queue())
19
20
    @staticmethod
21
    def get_test_filename(basename):
22
        return os.path.join(os.path.dirname(__file__),
23
                            "test_files",
24
                            basename + ".coffee")
25
26
    def test_good(self):
27
        good_file = self.get_test_filename("good")
28
        self.assertLinesValid(self.uut, [], good_file)
29
30
    def test_warn(self):
31
        warn_file = self.get_test_filename("warning")
32
        self.assertLinesInvalid(self.uut, [], warn_file)
33
34
    def test_err(self):
35
        err_file = self.get_test_filename("error")
36
        self.assertLinesInvalid(self.uut, [], err_file)
37
38
    def test_invalid(self):
39
        # CoffeeLint will generate an invalid CSV on this one!
40
        invalid_file = self.get_test_filename("invalid")
41
        self.assertLinesInvalid(self.uut, [], invalid_file)
42
43
44
if __name__ == '__main__':
45
    unittest.main(verbosity=2)
46