1 | import os |
||
2 | import re |
||
3 | import sys |
||
4 | import unittest |
||
5 | |||
6 | from coalib import coala_format |
||
7 | from coalib.misc.ContextManagers import prepare_file |
||
8 | from tests.TestUtilities import bear_test_module, execute_coala |
||
9 | |||
10 | |||
11 | class coalaFormatTest(unittest.TestCase): |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
![]() |
|||
12 | |||
13 | def setUp(self): |
||
14 | self.old_argv = sys.argv |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
15 | |||
16 | def tearDown(self): |
||
17 | sys.argv = self.old_argv |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
18 | |||
19 | def test_line_count(self): |
||
20 | with bear_test_module(), \ |
||
21 | prepare_file(["#fixme"], None) as (lines, filename): |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Comprehensibility
Best Practice
introduced
by
|
|||
22 | retval, output = execute_coala(coala_format.main, "coala-format", |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
23 | "-c", os.devnull, |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
24 | "-f", re.escape(filename), |
||
25 | "-b", "LineCountTestBear") |
||
26 | self.assertRegex(output, r'message:This file has [0-9]+ lines.', |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
27 | "coala-format output for line count should " |
||
28 | "not be empty") |
||
29 | self.assertEqual(retval, 1, |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
30 | "coala-format must return exitcode 1 when it " |
||
31 | "yields results") |
||
32 |