Completed
Pull Request — master (#1504)
by Abdeali
01:41
created

coalib.tests.coalaTest.test_coala()   A

Complexity

Conditions 2

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 2
dl 0
loc 11
rs 9.4285
1
import sys
2
import os
3
import unittest
4
5
from coalib.tests.TestUtilities import execute_coala
6
from coalib.misc.ContextManagers import prepare_file
7
from coalib import coala
8
9
10
class coalaTest(unittest.TestCase):
11
12
    def setUp(self):
13
        self.old_argv = sys.argv
14
15
    def tearDown(self):
16
        sys.argv = self.old_argv
17
18
    def test_coala(self):
19
        with prepare_file(["#fixme"], None) as (lines, filename):
20
            bear = "LineCountBear"
21
            retval, output = execute_coala(
22
                             coala.main,
23
                            "coala", "-c", os.devnull,
24
                            "--settings", "files=" + filename,
25
                            "bears=" + bear)
26
        self.assertIn("This file has 1 lines.",
27
                      output,
28
                      "The output should report count as 1 lines")
29