Skip to content
Permalink
Browse files

fixes remaining unitest

  • Loading branch information...
sdpython committed Mar 21, 2019
1 parent 3338dcf commit f7e19a18fb205888d482ef2029eb1ff12cc4e835
Showing with 12 additions and 3 deletions.
  1. +3 −2 _unittests/ut_pycode/test_coverage_helper.py
  2. +9 −1 src/pyquickhelper/pycode/coverage_helper.py
@@ -23,7 +23,7 @@ def process(content):

temp = get_temp_folder(__file__, "temp_coverage_combine")
source = os.path.normpath(os.path.abspath(
os.path.join(temp, "..", "..", "..", "src")))
os.path.join(temp, "..", "..", "..")))
self.assertExists(source)
cov1 = os.path.join(temp, "..", "data", "_coverage_dumps",
"tkinterquickhelper", "ba594812", "20171226T1558", '.coverage')
@@ -68,7 +68,7 @@ def process(content):

temp = get_temp_folder(__file__, "temp_coverage_combine2")
source = os.path.normpath(os.path.abspath(
os.path.join(temp, "..", "..", "..", "src")))
os.path.join(temp, "..", "..", "..")))
self.assertExists(source)
cov1 = os.path.join(temp, "..", "data", "pyq.coverage0")
cov2 = os.path.join(temp, "..", "data", "pyq.coverage1")
@@ -81,4 +81,5 @@ def process(content):


if __name__ == "__main__":
TestCoverageHelper().test_combine()
unittest.main()
@@ -198,6 +198,8 @@ def handle_filename(name, root_source_dup, begin, slash, lroot):
name, begin, exp.groups(), lroot))
name = found

if "src\\src" in name or "src/src" in name:
raise NameError("Irresponsible replacement '{0}'.".format(name))
return '"{0}"'.format(name)

def copy_replace(source, dest, root_source):
@@ -220,6 +222,9 @@ def copy_replace(source, dest, root_source):
if absolute_path:
alls = [_[0] for _ in reg.findall(content)]
lroot = find_longest_common_root(alls, begin)
if root_source_dup.endswith(begin + "src"):
raise RuntimeError("Cannot continue with '{0}'\nlroot='{1}'.".format(
root_source_dup, lroot))
content = reg.sub(lambda name: handle_filename(name, root_source_dup, begin, slash, lroot),
content)

@@ -251,12 +256,15 @@ def copy_replace(source, dest, root_source):
# Let's combine.
cov.combine(dests)

from coverage.misc import NoSource
from coverage.misc import NoSource, CoverageException
try:
cov.html_report(directory=output_path,
omit="*.html", ignore_errors=True)
except NoSource as e:
raise_exc(e, "", ex, ex2, "", destcov, source, dests, inter, cov)
except CoverageException as e:
raise RuntimeError(
"Unable to process report in '{0}'.".format(output_path)) from e

outfile = os.path.join(output_path, "coverage_report.xml")
cov.xml_report(outfile=outfile)

0 comments on commit f7e19a1

Please sign in to comment.
You can’t perform that action at this time.