mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-24 23:26:43 +00:00
Change tests for check_requirement to ensure that it accepts None in the comment field of a (version, location, comment) triple, and add a test that it raises ImportError when a module couldn't be imported. Also fix typo in a comment. refs #1339
This commit is contained in:
parent
2ed6019f78
commit
d318122cd2
@ -9,23 +9,27 @@ from allmydata.util.verlib import NormalizedVersion as V, \
|
||||
|
||||
class CheckRequirement(unittest.TestCase):
|
||||
def test_check_requirement(self):
|
||||
check_requirement("setuptools >= 0.6c6", {"setuptools": ("0.6", "", "")})
|
||||
check_requirement("pycrypto == 2.0.1, == 2.1, >= 2.3", {"pycrypto": ("2.1.0", "", "")})
|
||||
check_requirement("pycrypto == 2.0.1, == 2.1, >= 2.3", {"pycrypto": ("2.4.0", "", "")})
|
||||
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", "", "")})
|
||||
check_requirement("mock", {"mock": ("0.6.0", "", "")})
|
||||
check_requirement("foo >= 1.0", {"foo": ("1.0", "", ""), "bar": ("2.0", "", "")})
|
||||
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", "", "")})
|
||||
check_requirement("foolscap[secure_connections] >= 0.6.0", {"foolscap": ("0.7.0", "", None)})
|
||||
|
||||
self.failUnlessRaises(PackagingError, check_requirement,
|
||||
"foolscap[secure_connections] >= 0.6.0", {"foolscap": ("0.5.1", "", "")})
|
||||
"foolscap[secure_connections] >= 0.6.0", {"foolscap": ("0.5.1", "", None)})
|
||||
self.failUnlessRaises(PackagingError, check_requirement,
|
||||
"pycrypto == 2.0.1, == 2.1, >= 2.3", {"pycrypto": ("2.2.0", "", "")})
|
||||
"pycrypto == 2.0.1, == 2.1, >= 2.3", {"pycrypto": ("2.2.0", "", None)})
|
||||
self.failUnlessRaises(PackagingError, check_requirement,
|
||||
"foo >= 1.0", {})
|
||||
|
||||
self.failUnlessRaises(ImportError, check_requirement,
|
||||
"foo >= 1.0", {"foo": (None, None, "foomodule")})
|
||||
|
||||
|
||||
# based on https://bitbucket.org/tarek/distutilsversion/src/17df9a7d96ef/test_verlib.py
|
||||
|
||||
@ -121,7 +125,7 @@ class VersionTestCase(unittest.TestCase):
|
||||
self.failUnlessEqual(suggest('9.0.0pre1'), '9.0.0c1')
|
||||
|
||||
# we want to be able to parse Tcl-TK
|
||||
# they us "p1" "p2" for post releases
|
||||
# they use "p1" "p2" for post releases
|
||||
self.failUnlessEqual(suggest('1.4p1'), '1.4.post1')
|
||||
|
||||
# from darcsver
|
||||
|
Loading…
Reference in New Issue
Block a user