Exemplo n.º 1
0
 def test_comparison(self):
     acu = FileReporter("aa/afile.py")
     acu2 = FileReporter("aa/afile.py")
     zcu = FileReporter("aa/zfile.py")
     bcu = FileReporter("aa/bb/bfile.py")
     assert acu == acu2 and acu <= acu2 and acu >= acu2  # pylint: disable=chained-comparison
     assert acu < zcu and acu <= zcu and acu != zcu
     assert zcu > acu and zcu >= acu and zcu != acu
     assert acu < bcu and acu <= bcu and acu != bcu
     assert bcu > acu and bcu >= acu and bcu != acu
Exemplo n.º 2
0
 def setUp(self):
     coverage = coveralls(data_file=Arguments.data_file,
                          config_file=Arguments.config_file)
     coverage.load()
     self.reporter = CoverallsReporter(coverage, coverage.config)
     self.reporter.find_file_reporters(None)
     self.reporter.file_reporters.append(FileReporter('NotAFile.py'))
Exemplo n.º 3
0
    def __init__(self, filename, sources):
        FileReporter.__init__(self, filename)
        self._sources = sources
        self._cfile = None
        self._executable = set()
        self._excluded = set()

        for prefix in self._sources:
            if filename.startswith(prefix):
                prefix_len = len(prefix)
                cfile = filename[:prefix_len - 3] + "build/" + filename[prefix_len - 3:-4] + ".c"
                if os.path.isfile(cfile):
                    self._cfile = cfile
                break

        if not self._cfile:
            with open(self.filename, "rb") as f:
                count = 0
                for _ in f:
                    count += 1
                    self._executable.add(count)
        else:
            self._executable = self._parse_cfile_lines(self._cfile)