How to use the pyroma.pypidata function in pyroma

To help you get started, we’ve selected a few pyroma 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 regebro / pyroma / pyroma / tests.py View on Github external
def test_distribute(self):
        real_urlopen = urllib.urlopen
        real_server_proxy = xmlrpclib.ServerProxy
        try:
            xmlrpclib.ServerProxy = ProxyStub(
                "distributedata.py", xmlrpclib.ServerProxy, False
            )
            urllib.urlopen = urlopenstub
            data = pypidata.get_data("distribute")
            rating = rate(data)

            self.assertEqual(
                rating,
                (
                    9,
                    [
                        "The classifiers should specify what minor versions of Python "
                        "you support as well as what major version.",
                        "You should have three or more owners of the project on PyPI.",
                    ],
                ),
            )
        finally:
            xmlrpclib.ServerProxy = real_server_proxy
            urllib.urlopen = real_urlopen
github regebro / pyroma / pyroma / tests.py View on Github external
def test_complete(self):
        real_urlopen = urllib.urlopen
        real_server_proxy = xmlrpclib.ServerProxy
        try:
            xmlrpclib.ServerProxy = ProxyStub(
                "completedata.py", xmlrpclib.ServerProxy, False
            )
            urllib.urlopen = urlopenstub
            data = pypidata.get_data("complete")
            rating = rate(data)

            self.assertEqual(rating, (10, []))
        finally:
            xmlrpclib.ServerProxy = real_server_proxy
            urllib.urlopen = real_urlopen
github regebro / pyroma / pyroma / __init__.py View on Github external
def run(mode, argument):

    logging.info("-" * 30)
    logging.info("Checking " + argument)

    if mode == "directory":
        data = projectdata.get_data(os.path.abspath(argument))
        logging.info("Found " + data.get("name", "nothing"))
    elif mode == "file":
        data = distributiondata.get_data(os.path.abspath(argument))
        logging.info("Found " + data.get("name", "nothing"))
    else:
        # It's probably a package name
        data = pypidata.get_data(argument)
        logging.info("Found " + data.get("name", "nothing"))

    rating = ratings.rate(data)

    logging.info("-" * 30)
    for problem in rating[1]:
        # XXX It would be nice with a * pointlist instead, but that requires
        # that we know how wide the terminal is and nice word-breaks, so that's
        # for later.
        logging.info(problem)
    if rating[1]:
        logging.info("-" * 30)
    logging.info("Final rating: " + str(rating[0]) + "/10")
    logging.info(ratings.LEVELS[rating[0]])
    logging.info("-" * 30)