← Back to team overview

yellow team mailing list archive

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

 

Francesco Banconi has proposed merging lp:~frankban/launchpad/bug-987904-intermittent-failure into lp:launchpad.

Requested reviews:
  Launchpad Yellow Squad (yellow)
Related bugs:
  Bug #987904 in Launchpad itself: "lp.services.config.tests.test_config.TestLaunchpadConfig.test_iter intermittent failure"
  https://bugs.launchpad.net/launchpad/+bug/987904

For more details, see:
https://code.launchpad.net/~frankban/launchpad/bug-987904-intermittent-failure/+merge/104577

= 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.

-- 
https://code.launchpad.net/~frankban/launchpad/bug-987904-intermittent-failure/+merge/104577
Your team Launchpad Yellow Squad is requested to review the proposed merge of lp:~frankban/launchpad/bug-987904-intermittent-failure into lp:launchpad.
=== modified file 'lib/lp/services/config/tests/test_config.py'
--- lib/lp/services/config/tests/test_config.py	2011-12-29 05:40:17 +0000
+++ lib/lp/services/config/tests/test_config.py	2012-05-03 15:57:22 +0000
@@ -84,6 +84,8 @@
     def test_iter(self):
         # iter(config) returns an iterator of sections.
         config = lp.services.config.config
+        # Reload the config if needed.
+        config._getConfig()
         sections = set(config._config)
         self.assertEqual(sections, set(config))