How to use the pycobertura.filesystem.FileSystem.FileNotFound function in pycobertura

To help you get started, we’ve selected a few pycobertura examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aconrad / pycobertura / pycobertura / filesystem.py View on Github external
def open(self, filename):
        """
        Yield a file-like object for file `filename`.

        This function is a context manager.
        """
        filename = self.real_filename(filename)

        command = "git --no-pager show {}".format(filename)
        command_tokens = shlex.split(command)

        try:
            output = subprocess.check_output(command_tokens, cwd=self.repository)
        except (OSError, subprocess.CalledProcessError):
            raise self.FileNotFound(filename)

        output = output.decode("utf-8").rstrip()
        yield io.StringIO(output)
github aconrad / pycobertura / pycobertura / filesystem.py View on Github external
def open(self, filename):
        """
        Yield a file-like object for file `filename`.

        This function is a context manager.
        """
        filename = self.real_filename(filename)

        if not os.path.exists(filename):
            raise self.FileNotFound(filename)

        with codecs.open(filename, encoding="utf-8") as f:
            yield f
github aconrad / pycobertura / pycobertura / filesystem.py View on Github external
def open(self, filename):
        filename = self.real_filename(filename)

        try:
            f = self.zipfile.open(filename)
            yield f
            f.close()
        except KeyError:
            raise self.FileNotFound(filename)