Failed Conditions
Pull Request — master (#1109)
by Abdeali
02:02
created

test_run()   A

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
dl 0
loc 3
rs 10
1
import os
2
import subprocess
3
import sys
4
from queue import Queue
5
6
sys.path.insert(0, ".")
7
import unittest
8
from bears.tests.LocalBearTestHelper import LocalBearTestHelper
9
from bears.linters.DockerfileLintBear import DockerfileLintBear
10
from coalib.settings.Section import Section
11
12
13
class DockerfileLintBearTest(LocalBearTestHelper):
14
    def setUp(self):
15
        self.section = Section("test section")
16
        self.uut = DockerfileLintBear(self.section, Queue())
17
        self.test_file1 = os.path.join(os.path.dirname(__file__),
18
                                       "test_files",
19
                                       "dockerfilelint_test1")
20
        self.test_file2 = os.path.join(os.path.dirname(__file__),
21
                                       "test_files",
22
                                       "dockerfilelint_test2")
23
24
    def test_run(self):
25
        self.assertLinesValid(self.uut, [], self.test_file1)
26
        self.assertLinesInvalid(self.uut, [], self.test_file2)
27
28
29
def skip_test():
30
    try:
31
        subprocess.Popen(['dockerfile_lint', '--version'],
32
                         stdout=subprocess.PIPE,
33
                         stderr=subprocess.PIPE)
34
        return False
35
    except OSError:
36
        return "dockerfile-lint is not installed."
37
38
39
if __name__ == '__main__':
40
    unittest.main(verbosity=2)
41