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

bears.tests.php.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
from queue import Queue
5
from shutil import which
6
from unittest.case import skipIf
7
8
sys.path.insert(0, ".")
9
import unittest
10
from bears.tests.LocalBearTestHelper import LocalBearTestHelper
11
from bears.php.PHPLintBear import PHPLintBear
12
from coalib.settings.Section import Section
13
14
15
@skipIf(which('php') is None, 'PHP 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...
16
class PHPLintBearTest(LocalBearTestHelper):
17
    def setUp(self):
18
        self.section = Section("test section")
19
        self.uut = PHPLintBear(self.section, Queue())
20
        self.test_file1 = os.path.join(os.path.dirname(__file__),
21
                                       "test_files",
22
                                       "phplint_test1.php")
23
        self.test_file2 = os.path.join(os.path.dirname(__file__),
24
                                       "test_files",
25
                                       "phplint_test2.php")
26
27
    def test_run(self):
28
        # Test a file with errors and warnings
29
        self.assertLinesInvalid(
30
            self.uut,
31
            [],
32
            self.test_file1)
33
34
        # Test a file without any issues
35
        self.assertLinesValid(
36
            self.uut,
37
            [],
38
            self.test_file2)
39
40
41
if __name__ == '__main__':
42
    unittest.main(verbosity=2)
43