Merge lp:~cjwatson/lazr.config/zope.interface-5.0.0 into lp:lazr.config

Proposed by Colin Watson
Status: Merged
Merged at revision: 23
Proposed branch: lp:~cjwatson/lazr.config/zope.interface-5.0.0
Merge into: lp:lazr.config
Diff against target: 45 lines (+20/-2)
2 files modified
NEWS.rst (+4/-0)
src/lazr/config/tests/test_config.py (+16/-2)
To merge this branch: bzr merge lp:~cjwatson/lazr.config/zope.interface-5.0.0
Reviewer Review Type Date Requested Status
Cristian Gonzalez (community) Approve
Review via email: mp+396876@code.launchpad.net

Commit message

Fix tests with zope.interface >= 5.0.0.

Description of the change

To post a comment you must log in.
Revision history for this message
Cristian Gonzalez (cristiangsp) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'NEWS.rst'
2--- NEWS.rst 2019-11-04 17:08:58 +0000
3+++ NEWS.rst 2021-01-25 22:58:11 +0000
4@@ -2,6 +2,10 @@
5 NEWS for lazr.config
6 ====================
7
8+2.2.3
9+=====
10+- Fix tests with zope.interface >= 5.0.0.
11+
12 2.2.2 (2019-11-04)
13 ==================
14 - Officially add support for Python 3.7 and 3.8. The test suite required
15
16=== modified file 'src/lazr/config/tests/test_config.py'
17--- src/lazr/config/tests/test_config.py 2015-01-06 01:41:25 +0000
18+++ src/lazr/config/tests/test_config.py 2021-01-25 22:58:11 +0000
19@@ -158,10 +158,24 @@
20 UnknownKeyError, UnknownSectionError])
21
22 def test_not_stackable(self):
23+ try:
24+ from zope.interface.exceptions import MultipleInvalid
25+ except ImportError: # zope.interface < 5.0.0
26+ class MultipleInvalid(Exception):
27+ pass
28+
29 schema = ConfigSchema(self._testfile('base.conf'))
30 config = schema.load(self._testfile('local.conf'))
31- self.assertRaises(DoesNotImplement,
32- verifyObject, IStackableConfig, config.extends)
33+ try:
34+ verifyObject(IStackableConfig, config.extends)
35+ except DoesNotImplement:
36+ pass
37+ except MultipleInvalid as e:
38+ if not any(isinstance(invalid, DoesNotImplement)
39+ for invalid in e.exceptions):
40+ self.fail('MultipleInvalid raised without DoesNotImplement')
41+ else:
42+ self.fail('DoesNotImplement not raised')
43
44 def test_bad_pop(self):
45 schema = ConfigSchema(self._testfile('base.conf'))

Subscribers

People subscribed via source and target branches