diff --git a/openstack_requirements/tests/test_requirement.py b/openstack_requirements/tests/test_requirement.py index 52a5776fd..97c5130c2 100644 --- a/openstack_requirements/tests/test_requirement.py +++ b/openstack_requirements/tests/test_requirement.py @@ -12,8 +12,6 @@ import textwrap -import pkg_resources -import pkg_resources.extern.packaging.requirements as pkg_resources_reqs import testscenarios import testtools @@ -107,13 +105,7 @@ class TestParseRequirementFailures(testtools.TestCase): ('-f', dict(line='-f http://tarballs.openstack.org/'))] def test_does_not_parse(self): - try: - requirement.parse_line(self.line) - except (pkg_resources.RequirementParseError, - pkg_resources_reqs.InvalidRequirement): - pass - else: - self.fail('No exception triggered') + self.assertRaises(ValueError, requirement.parse_line, self.line) class TestToContent(testtools.TestCase): @@ -153,13 +145,8 @@ def test_urls(self): self.assertEqual(reqs, [(req, line)]) def test_not_urls(self): - try: - list(requirement.to_reqs('file:///foo#egg=foo')) - except (pkg_resources.RequirementParseError, - pkg_resources_reqs.InvalidRequirement): - pass - else: - self.fail('No exception triggered') + self.assertRaises( + ValueError, list, requirement.to_reqs('file:///foo#egg=foo')) def test_multiline(self): content = textwrap.dedent("""\