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
1=== modified file 'lib/lp/registry/browser/person.py'
2--- lib/lp/registry/browser/person.py 2009-09-18 21:37:55 +0000
3+++ lib/lp/registry/browser/person.py 2009-09-19 11:46:50 +0000
4@@ -130,7 +130,7 @@
5
6 from canonical.launchpad import helpers
7 from lp.registry.browser.team import TeamEditView
8-from lp.soyuz.browser.archive import traverse_named_ppa
9+#from lp.soyuz.browser.archive import traverse_named_ppa
10 from lp.soyuz.browser.archivesubscription import (
11 traverse_archive_subscription_for_subscriber)
12 from canonical.launchpad.browser.launchpad import get_launchpad_views
13@@ -382,6 +382,7 @@
14 ppa_name = self.request.stepstogo.consume()
15
16 try:
17+ from lp.soyuz.browser.archive import traverse_named_ppa
18 return traverse_named_ppa(self.context.name, ppa_name)
19 except NotFoundError:
20 self.request.setTraversalStack(traversal_stack)
21
22=== modified file 'lib/lp/registry/browser/tests/test_person_view.py'
23--- lib/lp/registry/browser/tests/test_person_view.py 2009-09-18 00:27:26 +0000
24+++ lib/lp/registry/browser/tests/test_person_view.py 2009-09-19 11:46:50 +0000
25@@ -38,14 +38,14 @@
26 for category in categories:
27 category_names.append(category.name)
28
29- self.assertEqual(category_names, [u'code', u'bugs', u'answers'],
30+ self.assertEqual(category_names, [u'code', u'bugs', u'answers'],
31 'Categories are not sorted correctly')
32
33 def _makeKarmaCache(self, person, product, category, value=10):
34 """ Create and return a KarmaCache entry with the given arguments.
35
36 In order to create the KarmaCache record we must switch to the DB
37- user 'karma', so tests that need a different user after calling
38+ user 'karma', so tests that need a different user after calling
39 this method should do run switchDbUser() themselves.
40 """
41