Merge lp:~frankban/launchpad/bug-987904-intermittent-failure into lp:launchpad

Proposed by Francesco Banconi on 2012-05-03
Status: Merged
Approved by: Gary Poster on 2012-05-03
Approved revision: no longer in the source branch.
Merged at revision: 15196
Proposed branch: lp:~frankban/launchpad/bug-987904-intermittent-failure
Merge into: lp:launchpad
Diff against target: 12 lines (+3/-0)
1 file modified
lib/lp/services/config/tests/test_config.py (+3/-0)
To merge this branch: bzr merge lp:~frankban/launchpad/bug-987904-intermittent-failure
Reviewer Review Type Date Requested Status
Gary Poster (community) 2012-05-03 Approve on 2012-05-03
Review via email: mp+104577@code.launchpad.net

Description of the Change

= Summary =

lp.services.config.tests.test_config.TestLaunchpadConfig.test_iter tries to iterate lp.services.config.config._config, that is None.

== Pre-implementation notes ==

The `_config` attribute of LaunchpadConfig is set to None by `_invalidateConfig` from the same class.
The latter is called by `LaunchpadConfig.setInstance`: this way the config can be regenerated by the next calls.
Again, `setInstance` is correctly called, as a clean up step, by lp.services.config.fixture.ConfigUseFixture.

== Implementation details ==

Reload the config in lp.services.config.tests.test_config.TestLaunchpadConfig.test_iter to ensure config._config is not None, as is done in all the relevant LaunchpadConfig methods.

== Tests ==

$ bin/test -vv --load-list ../t1
Running tests at level 1
Running zope.testing.testrunner.layer.UnitTests tests:
  Set up zope.testing.testrunner.layer.UnitTests in 0.000 seconds.
  Running:
 test_db_naming_stored_in_BaseLayer_configs (lp.testing.tests.test_pgsql.TestPgTestSetup)
 test_iter (lp.services.config.tests.test_config.TestLaunchpadConfig)
  Ran 2 tests with 0 failures and 0 errors in 0.661 seconds.
Tearing down left over layers:
  Tear down zope.testing.testrunner.layer.UnitTests in 0.000 seconds.

NO QA.

To post a comment you must log in.
Gary Poster (gary) wrote :

In your comment, please mention the bug number (987904) so people can see why it is important.
Thank you!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/services/config/tests/test_config.py'
2--- lib/lp/services/config/tests/test_config.py 2011-12-29 05:40:17 +0000
3+++ lib/lp/services/config/tests/test_config.py 2012-05-03 16:24:19 +0000
4@@ -84,6 +84,9 @@
5 def test_iter(self):
6 # iter(config) returns an iterator of sections.
7 config = lp.services.config.config
8+ # Reload the config if needed: without this call,
9+ # `config._config` can be None (see bug 987904).
10+ config._getConfig()
11 sections = set(config._config)
12 self.assertEqual(sections, set(config))
13