File: test_basic.py

package info (click to toggle)
kcov 43%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,600 kB
  • sloc: cpp: 12,617; ansic: 2,379; python: 2,001; sh: 333; makefile: 133; javascript: 65; xml: 7; asm: 4
file content (35 lines) | stat: -rw-r--r-- 1,070 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import os
import unittest

import libkcov
from libkcov import cobertura


class too_few_arguments(libkcov.TestCase):
    def runTest(self):
        rv, output = self.do(self.kcov + " " + self.outbase + "/kcov")

        assert b"Usage: kcov" in output
        assert rv == 1


class wrong_arguments(libkcov.TestCase):
    def runTest(self):
        rv, output = self.do(
            self.kcov + " --abc=efg " + self.outbase + "/kcov " + self.binaries + "/tests-stripped"
        )

        assert b"kcov: error: Unrecognized option: --abc=efg" in output
        assert rv == 1


class lookup_binary_in_path(libkcov.TestCase):
    @unittest.expectedFailure
    def runTest(self):
        os.environ["PATH"] += os.pathsep + self.sources + "/tests/python"
        noKcovRv, o = self.do(self.sources + "/tests/python/main 5")
        rv, o = self.do(self.kcov + " " + self.outbase + "/kcov " + "main 5")

        dom = cobertura.parseFile(self.outbase + "/kcov/main/cobertura.xml")
        assert cobertura.hitsPerLine(dom, "second.py", 34) == 2
        assert noKcovRv, rv