Example #1
0
def test():
    """Run all tests.

    :return: a :class:`unittest.TestResult` object
    """
    from .testsuite import run
    return run()
Example #2
0
def test():
    """Run all tests.

    :return: a :class:`unittest.TestResult` object
    """
    from .testsuite import run
    return run()
Example #3
0
    def run(self, _):  # type: (typing.List[str]) -> None

        if sys.version_info >= (3, 0, 0):
            t = io.StringIO
        else:
            t = io.BytesIO

        file = t()
        with redirect_stdout(file), redirect_stderr(file):
            # Import pyroma here because it uses logging and sys.stdout
            import pyroma  # noqa pylint: disable=all

            pyroma.run("directory", ".")
        file.seek(0)

        text = file.read()

        lines = text.split("\n")
        lines.pop(0)
        if sys.version_info >= (3, 0, 0):
            lines.pop(0)

        data = {"modules": {}}

        module = lines.pop(0)[6:].strip()
        data["modules"][module] = []
        lines.pop(0)
        if len(lines) >= 6:
            line = lines.pop(0)
            while line != "-" * 30:
                data["modules"][module].append(line)
                line = lines.pop(0)

        rating = lines.pop(0)
        data["rating"] = int(rating[14:-3])
        data["rating_word"] = lines.pop(0)

        self.status_code = 0 if data["rating"] == 10 else 1

        if data["rating"] == 10:
            data = []

        self.hook(data)
Example #4
0
def run_pyroma(data):
    import sys
    from zest.releaser.utils import ask
    if not ask("Run pyroma on the package before uploading?"):
        return
    try:
        from pyroma import run
        result = run(data['tagdir'])
        if result != 10:
            if not ask("Continue?"):
                sys.exit(1)
    except ImportError:
        if not ask("pyroma not available. Continue?"):
            sys.exit(1)
Example #5
0
def run_pyroma(data):
    import sys
    from zest.releaser.utils import ask
    if not ask("Run pyroma on the package before uploading?"):
        return
    try:
        from pyroma import run
        result = run(data['tagdir'])
        if result != 10:
            if not ask("Continue?"):
                sys.exit(1)
    except ImportError:
        if not ask("pyroma not available. Continue?"):
            sys.exit(1)
Example #6
0
    def run(self, _: list) -> None:
        file = io.StringIO()
        with redirect_stdout(file), redirect_stderr(io.StringIO()):
            # Import pyroma here because it uses logging and sys.stdout
            import pyroma  # noqa pylint: disable=all
            pyroma.run('directory', '.')
        file.seek(0)

        text = file.read()

        lines = text.split("\n")

        lines.pop(0)
        lines.pop(0)

        data = {'modules': {}}

        module = lines.pop(0)[6:].strip()
        data['modules'][module] = []
        lines.pop(0)
        if len(lines) >= 6:
            line = lines.pop(0)
            while line != "-" * 30:
                data['modules'][module].append(line)
                line = lines.pop(0)

        rating = lines.pop(0)
        data['rating'] = int(rating[14:-3])
        data['rating_word'] = lines.pop(0)

        self.status_code = 0 if data['rating'] == 10 else 1

        if data['rating'] == 10:
            data = []

        self.hook(data)
Example #7
0
def _run_pyroma(data):   # pragma: no cover
    """Run pyroma (used to perform checks before releasing a new version).
    """
    import sys
    from zest.releaser.utils import ask
    if not ask("Run pyroma on the package before uploading?"):
        return
    try:
        from pyroma import run
        result = run(data['tagdir'])
        if result != 10:
            if not ask("Continue?"):
                sys.exit(1)
    except ImportError:
        if not ask("pyroma not available. Continue?"):
            sys.exit(1)
Example #8
0
def _run_pyroma(data):  # pragma: no cover
    """Run pyroma (used to perform checks before releasing a new version).
    """
    import sys
    from zest.releaser.utils import ask
    if not ask("Run pyroma on the package before uploading?"):
        return
    try:
        from pyroma import run
        result = run(data['tagdir'])
        if result != 10:
            if not ask("Continue?"):
                sys.exit(1)
    except ImportError:
        if not ask("pyroma not available. Continue?"):
            sys.exit(1)
Example #9
0
def pyroma(ctx):
    """Check setup.py"""
    from pyroma import run
    run('directory', '.')