Merge lp:~bac/launchpad/import_error into lp:launchpad

Proposed by Brad Crittenden
Status: Merged
Merged at revision: not available
Proposed branch: lp:~bac/launchpad/import_error
Merge into: lp:launchpad
Diff against target: None lines
To merge this branch: bzr merge lp:~bac/launchpad/import_error
Reviewer Review Type Date Requested Status
Henning Eggers (community) code Approve
Review via email: mp+12115@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Brad Crittenden (bac) wrote :

= Summary =

The addition of a new test (registry/browser/tests/test_person_view.py) that does an
import of lp.registry.browser.person has caused a circular import error that only
shows up if you try to run just the registry tests using:
bin/test -vvm lp.registry.

The module that triggers the import error is lp.soyuz.browser.archive.ArchiveAdminView.

== Proposed fix ==

The "fix" is to move the import of lp.soyuz.browser.archive in person to be at the
single point of use. This fix may be a mask instead just covering up the real problem.

== Pre-implementation notes ==

Chats with Salgado.

== Implementation details ==

As above.

== Tests ==

bin/test -vvm lp.registry

== Demo and Q/A ==

N/A

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/lp/registry/browser/tests/test_person_view.py
  lib/lp/registry/browser/person.py

== Pylint notices ==

lib/lp/registry/browser/person.py
    117: [F0401] Unable to import 'lazr.delegates' (No module named delegates)
    118: [F0401] Unable to import 'lazr.config' (No module named config)
    119: [F0401] Unable to import 'lazr.restful.interface' (No module named restful)

Revision history for this message
Henning Eggers (henninge) wrote :

Please remove the commented-out import, as discussed on irc.

Thanks!
Henning

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/registry/browser/person.py'
--- lib/lp/registry/browser/person.py 2009-09-18 21:37:55 +0000
+++ lib/lp/registry/browser/person.py 2009-09-19 11:46:50 +0000
@@ -130,7 +130,7 @@
130130
131from canonical.launchpad import helpers131from canonical.launchpad import helpers
132from lp.registry.browser.team import TeamEditView132from lp.registry.browser.team import TeamEditView
133from lp.soyuz.browser.archive import traverse_named_ppa133#from lp.soyuz.browser.archive import traverse_named_ppa
134from lp.soyuz.browser.archivesubscription import (134from lp.soyuz.browser.archivesubscription import (
135 traverse_archive_subscription_for_subscriber)135 traverse_archive_subscription_for_subscriber)
136from canonical.launchpad.browser.launchpad import get_launchpad_views136from canonical.launchpad.browser.launchpad import get_launchpad_views
@@ -382,6 +382,7 @@
382 ppa_name = self.request.stepstogo.consume()382 ppa_name = self.request.stepstogo.consume()
383383
384 try:384 try:
385 from lp.soyuz.browser.archive import traverse_named_ppa
385 return traverse_named_ppa(self.context.name, ppa_name)386 return traverse_named_ppa(self.context.name, ppa_name)
386 except NotFoundError:387 except NotFoundError:
387 self.request.setTraversalStack(traversal_stack)388 self.request.setTraversalStack(traversal_stack)
388389
=== modified file 'lib/lp/registry/browser/tests/test_person_view.py'
--- lib/lp/registry/browser/tests/test_person_view.py 2009-09-18 00:27:26 +0000
+++ lib/lp/registry/browser/tests/test_person_view.py 2009-09-19 11:46:50 +0000
@@ -38,14 +38,14 @@
38 for category in categories:38 for category in categories:
39 category_names.append(category.name)39 category_names.append(category.name)
4040
41 self.assertEqual(category_names, [u'code', u'bugs', u'answers'], 41 self.assertEqual(category_names, [u'code', u'bugs', u'answers'],
42 'Categories are not sorted correctly')42 'Categories are not sorted correctly')
4343
44 def _makeKarmaCache(self, person, product, category, value=10):44 def _makeKarmaCache(self, person, product, category, value=10):
45 """ Create and return a KarmaCache entry with the given arguments.45 """ Create and return a KarmaCache entry with the given arguments.
4646
47 In order to create the KarmaCache record we must switch to the DB47 In order to create the KarmaCache record we must switch to the DB
48 user 'karma', so tests that need a different user after calling 48 user 'karma', so tests that need a different user after calling
49 this method should do run switchDbUser() themselves.49 this method should do run switchDbUser() themselves.
50 """50 """
5151