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
|