Merge lp:~michael.nelson/python-oops-dictconfig/1267055-handle-empty-fallback_chain into lp:python-oops-dictconfig

Proposed by Michael Nelson
Status: Merged
Approved by: James Westby
Approved revision: 19
Merged at revision: 19
Proposed branch: lp:~michael.nelson/python-oops-dictconfig/1267055-handle-empty-fallback_chain
Merge into: lp:python-oops-dictconfig
Diff against target: 46 lines (+12/-2)
3 files modified
README (+1/-1)
oops_dictconfig/dictconfig.py (+1/-1)
oops_dictconfig/tests/test_dictconfig.py (+10/-0)
To merge this branch: bzr merge lp:~michael.nelson/python-oops-dictconfig/1267055-handle-empty-fallback_chain
Reviewer Review Type Date Requested Status
James Westby (community) Approve
Review via email: mp+200806@code.launchpad.net

Commit message

An empty fallback_chain (which is the default configglue value) does not cause a normal publisher defn to be discarded.

Description of the change

An empty fallback_chain (which is the default configglue value) does not cause a normal publisher defn to be discarded.

See the bug description for more.

To post a comment you must log in.
Revision history for this message
James Westby (james-w) wrote :

Well spotted, thanks Michael.

James

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README'
2--- README 2013-04-18 20:28:57 +0000
3+++ README 2014-01-08 11:05:24 +0000
4@@ -243,7 +243,7 @@
5
6 or run::
7
8- python -m testools.run oops_dictconfig.tests.test_suite
9+ python -m testtools.run oops_dictconfig.tests.test_suite
10
11
12 ..
13
14=== modified file 'oops_dictconfig/dictconfig.py'
15--- oops_dictconfig/dictconfig.py 2013-04-18 16:51:16 +0000
16+++ oops_dictconfig/dictconfig.py 2014-01-08 11:05:24 +0000
17@@ -110,7 +110,7 @@
18 publishers = []
19 if 'publishers' in dict_config:
20 for publisher_defn in dict_config['publishers']:
21- if 'fallback_chain' in publisher_defn:
22+ if publisher_defn.get('fallback_chain'):
23 publish_method = make_fallback_chain(
24 publisher_defn['fallback_chain'])
25 else:
26
27=== modified file 'oops_dictconfig/tests/test_dictconfig.py'
28--- oops_dictconfig/tests/test_dictconfig.py 2013-04-18 16:51:16 +0000
29+++ oops_dictconfig/tests/test_dictconfig.py 2014-01-08 11:05:24 +0000
30@@ -71,6 +71,16 @@
31 self.assertEqual(1, len(publishers))
32 self.assertIsInstance(publishers[0].im_self, DateDirRepo)
33
34+ def test_datedir_with_empty_fallback_chain(self):
35+ """Empty fallback_chain does not break publisher bug 1267055."""
36+ publisher_defn = dict(type='datedir', error_dir=self.getUniqueString(),
37+ fallback_chain=[])
38+ config = self.get_config_from_dict([publisher_defn])
39+ publishers = get_publishers_from_function(config.publisher)
40+ self.assertEqual(1, len(publishers))
41+ self.assertEqual('publish', publishers[0].func_name)
42+ self.assertIsInstance(publishers[0].im_self, DateDirRepo)
43+
44 def test_datedir_sets_error_dir_on_repo(self):
45 error_dir = self.getUniqueString()
46 publisher_defn = dict(type='datedir', error_dir=error_dir)

Subscribers

People subscribed via source and target branches