diff --git a/renpycoverage.py b/renpycoverage.py index e1e248e7d0..0870c5a0cc 100644 --- a/renpycoverage.py +++ b/renpycoverage.py @@ -2,12 +2,13 @@ import Cython.Coverage import os -import coverage # @UnresolvedImport +import coverage # @UnresolvedImport import cPickle import ast ROOT = os.path.dirname(os.path.abspath(__file__)) + def _find_c_source(base_path): base_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "module", "gen.coverage", os.path.basename(base_path)) @@ -27,12 +28,12 @@ def _find_c_source(base_path): class FixedCythonReporter(coverage.FileReporter): def __init__(self, old, fn): -# fn = old.filename -# -# if not os.path.exists(fn): -# new_fn = os.path.join(os.path.dirname(fn), "module", os.path.basename(fn)) -# if os.path.exists(new_fn): -# fn = new_fn + # fn = old.filename + # + # if not os.path.exists(fn): + # new_fn = os.path.join(os.path.dirname(fn), "module", os.path.basename(fn)) + # if os.path.exists(new_fn): + # fn = new_fn super(FixedCythonReporter, self).__init__(fn) @@ -63,6 +64,7 @@ def _find_source_files(self, filename): "renpy/gl", "renpy/styledata", "renpy/text", + "renpy/audio", ] for i in pyx_search: @@ -71,10 +73,8 @@ def _find_source_files(self, filename): if os.path.exists(pyx_fn): break else: - print("Could not find pyx for", filename) return None, None - c_base = os.path.basename(filename)[:-4] + ".c" modules = [ @@ -84,6 +84,7 @@ def _find_source_files(self, filename): "renpy.gl.", "renpy.styledata.", "renpy.text.", + "renpy.audio.", "pysdlsound." ] @@ -97,7 +98,6 @@ def _find_source_files(self, filename): return c_fn, pyx_fn - def file_tracer(self, filename): if not filename.endswith(".pyx"): @@ -135,6 +135,7 @@ def source_filename(self): class PycodeVisitor(ast.NodeVisitor): + def __init__(self, lines): self.lines = lines @@ -238,6 +239,7 @@ def pycode_lines(self, pycode): def lines(self): return self._lines + class RenpyCoverage(coverage.CoveragePlugin): def file_tracer(self, filename):