Tolerate both new and old setuptools
New setuptools 20.2.2 seems to be throwing a new exception as it uses a vendorized version of packaging now. Let's make sure our tests works with both the older and newer versions. Change-Id: Iab9247e2026896bb7d25b125788ec3072f819dad
This commit is contained in:
parent
9de6412851
commit
0cf3c06ad9
@ -18,6 +18,11 @@ import testtools
|
|||||||
|
|
||||||
from openstack_requirements import requirement
|
from openstack_requirements import requirement
|
||||||
|
|
||||||
|
try:
|
||||||
|
InvalidRequirement = \
|
||||||
|
pkg_resources.extern.packaging.requirements.InvalidRequirement
|
||||||
|
except AttributeError:
|
||||||
|
InvalidRequirement = pkg_resources.RequirementParseError
|
||||||
|
|
||||||
load_tests = testscenarios.load_tests_apply_scenarios
|
load_tests = testscenarios.load_tests_apply_scenarios
|
||||||
|
|
||||||
@ -93,7 +98,7 @@ class TestParseRequirementFailures(testtools.TestCase):
|
|||||||
('-f', dict(line='-f http://tarballs.openstack.org/'))]
|
('-f', dict(line='-f http://tarballs.openstack.org/'))]
|
||||||
|
|
||||||
def test_does_not_parse(self):
|
def test_does_not_parse(self):
|
||||||
with testtools.ExpectedException(pkg_resources.RequirementParseError):
|
with testtools.ExpectedException(InvalidRequirement):
|
||||||
requirement.parse_line(self.line)
|
requirement.parse_line(self.line)
|
||||||
|
|
||||||
|
|
||||||
@ -134,7 +139,7 @@ class TestToReqs(testtools.TestCase):
|
|||||||
self.assertEqual(reqs, [(req, line)])
|
self.assertEqual(reqs, [(req, line)])
|
||||||
|
|
||||||
def test_not_urls(self):
|
def test_not_urls(self):
|
||||||
with testtools.ExpectedException(pkg_resources.RequirementParseError):
|
with testtools.ExpectedException(InvalidRequirement):
|
||||||
list(requirement.to_reqs('file:///foo#egg=foo'))
|
list(requirement.to_reqs('file:///foo#egg=foo'))
|
||||||
|
|
||||||
def test_multiline(self):
|
def test_multiline(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user