Пример #1
0
    def test_check_requirement(self):
        check_requirement("setuptools >= 0.6c6",
                          {"setuptools": ("0.6", "", None)})
        check_requirement("setuptools >= 0.6c6",
                          {"setuptools": ("0.6", "", "distribute")})
        check_requirement("pycrypto == 2.0.1, == 2.1, >= 2.3",
                          {"pycrypto": ("2.1.0", "", None)})
        check_requirement("pycrypto == 2.0.1, == 2.1, >= 2.3",
                          {"pycrypto": ("2.4.0", "", None)})

        check_requirement("zope.interface",
                          {"zope.interface": ("unknown", "", None)})
        check_requirement("mock", {"mock": ("0.6.0", "", None)})
        check_requirement("foo >= 1.0", {
            "foo": ("1.0", "", None),
            "bar": ("2.0", "", None)
        })

        check_requirement("foolscap[secure_connections] >= 0.6.0",
                          {"foolscap": ("0.7.0", "", None)})

        try:
            check_requirement("foolscap[secure_connections] >= 0.6.0",
                              {"foolscap": ("0.6.1+", "", None)})
            # succeeding is ok
        except PackagingError, e:
            self.failUnlessIn("could not parse", str(e))
Пример #2
0
    def test_check_requirement(self):
        check_requirement("setuptools >= 0.6c6", {"setuptools": ("0.6", "", None)})
        check_requirement("setuptools >= 0.6c6", {"setuptools": ("0.6", "", "distribute")})
        check_requirement("pycrypto == 2.0.1, == 2.1, >= 2.3", {"pycrypto": ("2.1.0", "", None)})
        check_requirement("pycrypto == 2.0.1, == 2.1, >= 2.3", {"pycrypto": ("2.4.0", "", None)})
        check_requirement("zope.interface <= 3.6.2, >= 3.6.6", {"zope.interface": ("3.6.1", "", None)})
        check_requirement("zope.interface <= 3.6.2, >= 3.6.6", {"zope.interface": ("3.6.6", "", None)})

        check_requirement("zope.interface", {"zope.interface": ("unknown", "", None)})
        check_requirement("mock", {"mock": ("0.6.0", "", None)})
        check_requirement("foo >= 1.0", {"foo": ("1.0", "", None), "bar": ("2.0", "", None)})

        check_requirement("foolscap[secure_connections] >= 0.6.0", {"foolscap": ("0.7.0", "", None)})

        try:
            check_requirement("foolscap[secure_connections] >= 0.6.0", {"foolscap": ("0.6.1+", "", None)})
            # succeeding is ok
        except PackagingError, e:
            self.failUnlessIn("could not parse", str(e))
Пример #3
0
    def _check_success(self, req, vers_and_locs):
        check_requirement(req, vers_and_locs)

        for pkg, ver in vers_and_locs.items():
            self.failUnless(ver[0] in Requirement.parse(req), str((ver, req)))