launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #01641
[Merge] lp:~sinzui/launchpad/apocalypse-interface-imports-8 into lp:launchpad/devel
Curtis Hovey has proposed merging lp:~sinzui/launchpad/apocalypse-interface-imports-8 into lp:launchpad/devel.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
This is my branch to fix all glob imports in python tests.
lp:~sinzui/launchpad/apocalypse-interface-imports-8
Diff size: 696
Launchpad bug: https://bugs.launchpad.net/bugs/664262
Test command: The entire test suite
Pre-implementation: no one
Target release: 10.11
Fix all glob imports in python tests
------------------------------------
The deglobber and format-new-and-modified-imports utilities can be used to fix
the modules to import from true locations in less than an hour.
Rules
-----
* Update the deblobber regexp to convert multiline import from
canonical.launchpad.interfaces to single line imports.
* Run the new rule with the deglob import rule to fix all imports.
* Run format-new-and-modified-imports to sort and format the changes
with the entire module.
* Run the tests
QA
--
None
Lint
----
Linting changed files:
lib/canonical/launchpad/ftests/keys_for_tests.py
lib/canonical/launchpad/ftests/test_system_documentation.py
lib/canonical/launchpad/scripts/ftests/test_keyringtrustanalyser.py
lib/canonical/launchpad/tests/test_helpers.py
lib/canonical/launchpad/webapp/ftests/test_annotations.py
lib/canonical/launchpad/webapp/tests/test_authutility.py
lib/canonical/launchpad/webapp/tests/test_dbpolicy.py
lib/canonical/launchpad/webapp/tests/test_encryptor.py
lib/canonical/launchpad/webapp/tests/test_loginsource.py
lib/canonical/launchpad/xmlrpc/tests/test_authserver.py
lib/canonical/librarian/ftests/test_web.py
lib/lp/archivepublisher/tests/test_config.py
lib/lp/archivepublisher/tests/test_generate_ppa_htaccess.py
lib/lp/archivepublisher/tests/util.py
lib/lp/archiveuploader/tests/test_ppauploadprocessor.py
lib/lp/archiveuploader/tests/test_uploadprocessor.py
lib/lp/bugs/browser/tests/test_bugattachment_file_access.py
lib/lp/bugs/mail/tests/test_bug_duplicate_notifications.py
lib/lp/bugs/scripts/checkwatches/tests/test_core.py
lib/lp/bugs/tests/test_bugtask_0.py
lib/lp/codehosting/puller/tests/test_acceptance.py
lib/lp/codehosting/scanner/tests/test_buglinks.py
lib/lp/codehosting/scanner/tests/test_mergedetection.py
lib/lp/codehosting/tests/servers.py
lib/lp/coop/answersbugs/tests/test_doc.py
lib/lp/registry/tests/test_xmlrpc.py
lib/lp/scripts/tests/test_garbo.py
lib/lp/services/database/tests/test_prejoin.py
lib/lp/services/features/browser/tests/test_feature_editor.py
lib/lp/soyuz/tests/test_doc.py
utilities/migrater/deglob.py
^ There are a lot of lint issues in the canonical tests. I can fix all of
these before landing.
Test
----
No rules were changed. The whole automatted task too 20 minutes :)
--
https://code.launchpad.net/~sinzui/launchpad/apocalypse-interface-imports-8/+merge/39008
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~sinzui/launchpad/apocalypse-interface-imports-8 into lp:launchpad/devel.
=== modified file 'lib/canonical/launchpad/ftests/keys_for_tests.py'
--- lib/canonical/launchpad/ftests/keys_for_tests.py 2010-10-03 15:30:06 +0000
+++ lib/canonical/launchpad/ftests/keys_for_tests.py 2010-10-21 02:06:08 +0000
@@ -25,12 +25,12 @@
import gpgme
from zope.component import getUtility
-from canonical.launchpad.interfaces import (
+from canonical.launchpad.interfaces.gpghandler import IGPGHandler
+from lp.registry.interfaces.gpg import (
GPGKeyAlgorithm,
- IGPGHandler,
IGPGKeySet,
- IPersonSet,
)
+from lp.registry.interfaces.person import IPersonSet
gpgkeysdir = os.path.join(os.path.dirname(__file__), 'gpgkeys')
=== modified file 'lib/canonical/launchpad/ftests/test_system_documentation.py'
--- lib/canonical/launchpad/ftests/test_system_documentation.py 2010-10-11 18:29:14 +0000
+++ lib/canonical/launchpad/ftests/test_system_documentation.py 2010-10-21 02:06:08 +0000
@@ -23,11 +23,6 @@
ANONYMOUS,
login,
)
-from canonical.launchpad.interfaces import (
- IDistributionSet,
- ILanguageSet,
- IPersonSet,
- )
from canonical.launchpad.testing import browser
from canonical.launchpad.testing.systemdocs import (
LayeredDocFileSuite,
@@ -47,6 +42,9 @@
)
from lp.bugs.interfaces.bug import CreateBugParams
from lp.bugs.interfaces.bugtask import IBugTaskSet
+from lp.registry.interfaces.distribution import IDistributionSet
+from lp.registry.interfaces.person import IPersonSet
+from lp.services.worlddata.interfaces.language import ILanguageSet
from lp.testing.mail_helpers import pop_notifications
@@ -68,7 +66,7 @@
validity.
"""
from canonical.launchpad.database import EmailAddress
- from canonical.launchpad.interfaces import EmailAddressStatus
+ from canonical.launchpad.interfaces.emailaddress import EmailAddressStatus
stevea_emailaddress = EmailAddress.byEmail(
'steve.alexander@xxxxxxxxxxxxxxx')
stevea_emailaddress.status = EmailAddressStatus.NEW
=== modified file 'lib/canonical/launchpad/scripts/ftests/test_keyringtrustanalyser.py'
--- lib/canonical/launchpad/scripts/ftests/test_keyringtrustanalyser.py 2010-10-04 19:50:45 +0000
+++ lib/canonical/launchpad/scripts/ftests/test_keyringtrustanalyser.py 2010-10-21 02:06:08 +0000
@@ -8,13 +8,13 @@
from zope.component import getUtility
from canonical.launchpad.ftests import keys_for_tests
-from canonical.launchpad.interfaces import (
+from canonical.launchpad.interfaces.emailaddress import (
EmailAddressStatus,
IEmailAddressSet,
- IGPGHandler,
- IPersonSet,
)
+from canonical.launchpad.interfaces.gpghandler import IGPGHandler
from canonical.testing.layers import LaunchpadZopelessLayer
+from lp.registry.interfaces.person import IPersonSet
from lp.registry.scripts.keyringtrustanalyser import (
addOtherKeyring,
addTrustedKeyring,
=== modified file 'lib/canonical/launchpad/tests/test_helpers.py'
--- lib/canonical/launchpad/tests/test_helpers.py 2010-10-12 01:11:41 +0000
+++ lib/canonical/launchpad/tests/test_helpers.py 2010-10-21 02:06:08 +0000
@@ -9,12 +9,10 @@
from canonical.launchpad import helpers
from canonical.launchpad.ftests import login
-from canonical.launchpad.interfaces import (
- ILanguageSet,
- ILaunchBag,
- IPerson,
- )
+from canonical.launchpad.webapp.interfaces import ILaunchBag
from canonical.testing.layers import LaunchpadFunctionalLayer
+from lp.registry.interfaces.person import IPerson
+from lp.services.worlddata.interfaces.language import ILanguageSet
from lp.testing.factory import LaunchpadObjectFactory
from lp.translations.utilities.translation_export import LaunchpadWriteTarFile
=== modified file 'lib/canonical/launchpad/webapp/ftests/test_annotations.py'
--- lib/canonical/launchpad/webapp/ftests/test_annotations.py 2010-10-04 19:50:45 +0000
+++ lib/canonical/launchpad/webapp/ftests/test_annotations.py 2010-10-21 02:06:08 +0000
@@ -17,7 +17,7 @@
connection = db.open()
root = connection.root()
handle_before_traversal(root)
- from canonical.launchpad.interfaces import IZODBAnnotation
+ from canonical.launchpad.interfaces.launchpad import IZODBAnnotation
from lp.bugs.model.bug import Bug
from lp.registry.model.product import Product
bug = Bug.get(1)
=== modified file 'lib/canonical/launchpad/webapp/tests/test_authutility.py'
--- lib/canonical/launchpad/webapp/tests/test_authutility.py 2010-10-03 15:30:06 +0000
+++ lib/canonical/launchpad/webapp/tests/test_authutility.py 2010-10-21 02:06:08 +0000
@@ -16,11 +16,8 @@
from zope.publisher.browser import TestRequest
from zope.publisher.interfaces.http import IHTTPCredentials
-from canonical.launchpad.interfaces import (
- IAccount,
- IPasswordEncryptor,
- IPerson,
- )
+from canonical.launchpad.interfaces.account import IAccount
+from canonical.launchpad.interfaces.launchpad import IPasswordEncryptor
from canonical.launchpad.webapp.authentication import (
LaunchpadPrincipal,
PlacelessAuthUtility,
@@ -29,6 +26,7 @@
IPlacelessAuthUtility,
IPlacelessLoginSource,
)
+from lp.registry.interfaces.person import IPerson
class DummyPerson(object):
=== modified file 'lib/canonical/launchpad/webapp/tests/test_dbpolicy.py'
--- lib/canonical/launchpad/webapp/tests/test_dbpolicy.py 2010-10-03 15:30:06 +0000
+++ lib/canonical/launchpad/webapp/tests/test_dbpolicy.py 2010-10-21 02:06:08 +0000
@@ -23,7 +23,7 @@
ISession,
)
-from canonical.launchpad.interfaces import (
+from canonical.launchpad.interfaces.lpstorm import (
IMasterStore,
ISlaveStore,
)
=== modified file 'lib/canonical/launchpad/webapp/tests/test_encryptor.py'
--- lib/canonical/launchpad/webapp/tests/test_encryptor.py 2010-10-03 15:30:06 +0000
+++ lib/canonical/launchpad/webapp/tests/test_encryptor.py 2010-10-21 02:06:08 +0000
@@ -12,7 +12,7 @@
from zope.app.testing.placelesssetup import PlacelessSetup
from zope.component import getUtility
-from canonical.launchpad.interfaces import IPasswordEncryptor
+from canonical.launchpad.interfaces.launchpad import IPasswordEncryptor
from canonical.launchpad.webapp.authentication import SSHADigestEncryptor
=== modified file 'lib/canonical/launchpad/webapp/tests/test_loginsource.py'
--- lib/canonical/launchpad/webapp/tests/test_loginsource.py 2010-10-04 19:50:45 +0000
+++ lib/canonical/launchpad/webapp/tests/test_loginsource.py 2010-10-21 02:06:08 +0000
@@ -9,10 +9,10 @@
ANONYMOUS,
login,
)
-from canonical.launchpad.interfaces import IPersonSet
from canonical.launchpad.webapp.authentication import IPlacelessLoginSource
from canonical.launchpad.webapp.interfaces import AccessLevel
from canonical.testing.layers import DatabaseFunctionalLayer
+from lp.registry.interfaces.person import IPersonSet
class LaunchpadLoginSourceTest(unittest.TestCase):
=== modified file 'lib/canonical/launchpad/xmlrpc/tests/test_authserver.py'
--- lib/canonical/launchpad/xmlrpc/tests/test_authserver.py 2010-10-03 15:30:06 +0000
+++ lib/canonical/launchpad/xmlrpc/tests/test_authserver.py 2010-10-21 02:06:08 +0000
@@ -10,7 +10,7 @@
from zope.component import getUtility
from zope.publisher.xmlrpc import TestRequest
-from canonical.launchpad.interfaces import IPrivateApplication
+from canonical.launchpad.interfaces.launchpad import IPrivateApplication
from canonical.launchpad.xmlrpc import faults
from canonical.launchpad.xmlrpc.authserver import AuthServerAPIView
from canonical.testing.layers import DatabaseFunctionalLayer
=== modified file 'lib/canonical/librarian/ftests/test_web.py'
--- lib/canonical/librarian/ftests/test_web.py 2010-10-04 19:50:45 +0000
+++ lib/canonical/librarian/ftests/test_web.py 2010-10-21 02:06:08 +0000
@@ -5,7 +5,10 @@
from datetime import datetime
import httplib
import unittest
-from urllib2 import urlopen, HTTPError
+from urllib2 import (
+ HTTPError,
+ urlopen,
+ )
from urlparse import urlparse
import pytz
@@ -19,15 +22,15 @@
flush_database_updates,
session_store,
)
+from canonical.launchpad.database import LibraryFileAlias
from canonical.launchpad.database.librarian import TimeLimitedToken
+from canonical.launchpad.interfaces.librarian import ILibraryFileAliasSet
+from canonical.launchpad.interfaces.lpstorm import IMasterStore
from canonical.librarian.client import (
get_libraryfilealias_download_path,
LibrarianClient,
)
from canonical.librarian.interfaces import DownloadFailed
-from canonical.launchpad.database import LibraryFileAlias
-from canonical.launchpad.interfaces import IMasterStore
-from canonical.launchpad.interfaces.librarian import ILibraryFileAliasSet
from canonical.testing.layers import (
LaunchpadFunctionalLayer,
LaunchpadZopelessLayer,
=== modified file 'lib/lp/archivepublisher/tests/test_config.py'
--- lib/lp/archivepublisher/tests/test_config.py 2010-10-04 19:50:45 +0000
+++ lib/lp/archivepublisher/tests/test_config.py 2010-10-21 02:06:08 +0000
@@ -8,12 +8,12 @@
from zope.component import getUtility
from canonical.config import config
-from canonical.launchpad.interfaces import IDistributionSet
from canonical.testing.layers import LaunchpadZopelessLayer
from lp.archivepublisher.config import (
Config,
LucilleConfigError,
)
+from lp.registry.interfaces.distribution import IDistributionSet
from lp.testing import TestCaseWithFactory
=== modified file 'lib/lp/archivepublisher/tests/test_generate_ppa_htaccess.py'
--- lib/lp/archivepublisher/tests/test_generate_ppa_htaccess.py 2010-10-03 15:30:06 +0000
+++ lib/lp/archivepublisher/tests/test_generate_ppa_htaccess.py 2010-10-21 02:06:08 +0000
@@ -18,17 +18,15 @@
from zope.security.proxy import removeSecurityProxy
from canonical.config import config
-from canonical.launchpad.interfaces import (
- IDistributionSet,
- IPersonSet,
- TeamMembershipStatus,
- )
from canonical.launchpad.scripts import QuietFakeLogger
from canonical.testing.layers import LaunchpadZopelessLayer
from lp.archivepublisher.config import getPubConfig
from lp.archivepublisher.scripts.generate_ppa_htaccess import (
HtaccessTokenGenerator,
)
+from lp.registry.interfaces.distribution import IDistributionSet
+from lp.registry.interfaces.person import IPersonSet
+from lp.registry.interfaces.teammembership import TeamMembershipStatus
from lp.services.mail import stub
from lp.services.scripts.interfaces.scriptactivity import IScriptActivitySet
from lp.soyuz.enums import (
=== modified file 'lib/lp/archivepublisher/tests/util.py'
--- lib/lp/archivepublisher/tests/util.py 2010-10-03 15:30:06 +0000
+++ lib/lp/archivepublisher/tests/util.py 2010-10-21 02:06:08 +0000
@@ -7,9 +7,9 @@
# Utility functions/classes for testing the archive publisher.
-from canonical.launchpad.interfaces import SeriesStatus
from lp.archivepublisher.tests import datadir
from lp.registry.interfaces.pocket import PackagePublishingPocket
+from lp.registry.interfaces.series import SeriesStatus
__all__ = ['FakeLogger']
=== modified file 'lib/lp/archiveuploader/tests/test_ppauploadprocessor.py'
--- lib/lp/archiveuploader/tests/test_ppauploadprocessor.py 2010-10-07 16:51:23 +0000
+++ lib/lp/archiveuploader/tests/test_ppauploadprocessor.py 2010-10-21 02:06:08 +0000
@@ -19,10 +19,8 @@
from canonical.config import config
from canonical.launchpad.database import Component
-from canonical.launchpad.interfaces import (
- ILaunchpadCelebrities,
- ILibraryFileAliasSet,
- )
+from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
+from canonical.launchpad.interfaces.librarian import ILibraryFileAliasSet
from canonical.launchpad.testing.fakepackager import FakePackager
from lp.app.errors import NotFoundError
from lp.archiveuploader.tests.test_uploadprocessor import (
@@ -38,12 +36,8 @@
PackageUploadStatus,
SourcePackageFormat,
)
-from lp.soyuz.interfaces.archive import (
- IArchiveSet,
- )
-from lp.soyuz.interfaces.queue import (
- NonBuildableSourceUploadError,
- )
+from lp.soyuz.interfaces.archive import IArchiveSet
+from lp.soyuz.interfaces.queue import NonBuildableSourceUploadError
from lp.soyuz.interfaces.sourcepackageformat import (
ISourcePackageFormatSelectionSet,
)
=== modified file 'lib/lp/archiveuploader/tests/test_uploadprocessor.py'
--- lib/lp/archiveuploader/tests/test_uploadprocessor.py 2010-10-18 13:55:07 +0000
+++ lib/lp/archiveuploader/tests/test_uploadprocessor.py 2010-10-21 02:06:08 +0000
@@ -28,11 +28,10 @@
from canonical.config import config
from canonical.database.constants import UTC_NOW
from canonical.launchpad.ftests import import_public_test_keys
-from canonical.launchpad.interfaces import ILibraryFileAliasSet
+from canonical.launchpad.interfaces.librarian import ILibraryFileAliasSet
from canonical.launchpad.testing.fakepackager import FakePackager
from canonical.launchpad.webapp.errorlog import ErrorReportingUtility
from canonical.testing.layers import LaunchpadZopelessLayer
-
from lp.app.errors import NotFoundError
from lp.archiveuploader.uploadpolicy import (
AbstractUploadPolicy,
@@ -61,21 +60,15 @@
PackageUploadStatus,
SourcePackageFormat,
)
-from lp.soyuz.interfaces.archive import (
- IArchiveSet,
- )
-from lp.soyuz.interfaces.archivepermission import (
- IArchivePermissionSet,
- )
+from lp.soyuz.interfaces.archive import IArchiveSet
+from lp.soyuz.interfaces.archivepermission import IArchivePermissionSet
from lp.soyuz.interfaces.component import IComponentSet
from lp.soyuz.interfaces.packageset import IPackagesetSet
from lp.soyuz.interfaces.publishing import (
IPublishingSet,
PackagePublishingStatus,
)
-from lp.soyuz.interfaces.queue import (
- QueueInconsistentStateError,
- )
+from lp.soyuz.interfaces.queue import QueueInconsistentStateError
from lp.soyuz.interfaces.sourcepackageformat import (
ISourcePackageFormatSelectionSet,
)
=== modified file 'lib/lp/bugs/browser/tests/test_bugattachment_file_access.py'
--- lib/lp/bugs/browser/tests/test_bugattachment_file_access.py 2010-10-04 19:50:45 +0000
+++ lib/lp/bugs/browser/tests/test_bugattachment_file_access.py 2010-10-21 02:06:08 +0000
@@ -14,25 +14,23 @@
from zope.security.interfaces import Unauthorized
from canonical.launchpad.browser.librarian import (
+ SafeStreamOrRedirectLibraryFileAliasView,
StreamOrRedirectLibraryFileAliasView,
- SafeStreamOrRedirectLibraryFileAliasView,
)
-from canonical.launchpad.interfaces import ILaunchBag
from canonical.launchpad.interfaces.librarian import (
ILibraryFileAliasWithParent,
)
+from canonical.launchpad.webapp.interfaces import ILaunchBag
from canonical.launchpad.webapp.publisher import RedirectionView
from canonical.launchpad.webapp.servers import LaunchpadTestRequest
from canonical.testing.layers import LaunchpadFunctionalLayer
-from lp.bugs.browser.bugattachment import (
- BugAttachmentFileNavigation,
- )
+from lp.bugs.browser.bugattachment import BugAttachmentFileNavigation
+import lp.services.features
+from lp.services.features.flags import NullFeatureController
from lp.testing import (
login_person,
TestCaseWithFactory,
)
-import lp.services.features
-from lp.services.features.flags import NullFeatureController
class TestAccessToBugAttachmentFiles(TestCaseWithFactory):
=== modified file 'lib/lp/bugs/mail/tests/test_bug_duplicate_notifications.py'
--- lib/lp/bugs/mail/tests/test_bug_duplicate_notifications.py 2010-10-04 19:50:45 +0000
+++ lib/lp/bugs/mail/tests/test_bug_duplicate_notifications.py 2010-10-21 02:06:08 +0000
@@ -12,10 +12,10 @@
from zope.event import notify
from zope.interface import providedBy
-from lp.bugs.model.bugnotification import BugNotification
-from canonical.launchpad.interfaces import BugTaskStatus
from canonical.launchpad.webapp.interfaces import ILaunchBag
from canonical.testing.layers import DatabaseFunctionalLayer
+from lp.bugs.interfaces.bugtask import BugTaskStatus
+from lp.bugs.model.bugnotification import BugNotification
from lp.bugs.scripts.bugnotification import construct_email_notifications
from lp.services.mail import stub
from lp.testing import TestCaseWithFactory
=== modified file 'lib/lp/bugs/scripts/checkwatches/tests/test_core.py'
--- lib/lp/bugs/scripts/checkwatches/tests/test_core.py 2010-10-04 19:50:45 +0000
+++ lib/lp/bugs/scripts/checkwatches/tests/test_core.py 2010-10-21 02:06:08 +0000
@@ -15,20 +15,20 @@
from canonical.config import config
from canonical.launchpad.ftests import login
-from canonical.launchpad.interfaces import (
- BugTaskStatus,
- BugTrackerType,
- IBugSet,
- IBugTaskSet,
- ILaunchpadCelebrities,
- IPersonSet,
- IProductSet,
- IQuestionSet,
- )
+from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
from canonical.launchpad.scripts.logger import QuietFakeLogger
from canonical.testing.layers import LaunchpadZopelessLayer
+from lp.answers.interfaces.questioncollection import IQuestionSet
from lp.bugs.externalbugtracker.bugzilla import BugzillaAPI
-from lp.bugs.interfaces.bugtracker import IBugTrackerSet
+from lp.bugs.interfaces.bug import IBugSet
+from lp.bugs.interfaces.bugtask import (
+ BugTaskStatus,
+ IBugTaskSet,
+ )
+from lp.bugs.interfaces.bugtracker import (
+ BugTrackerType,
+ IBugTrackerSet,
+ )
from lp.bugs.scripts import checkwatches
from lp.bugs.scripts.checkwatches.base import (
CheckWatchesErrorUtility,
@@ -45,6 +45,8 @@
TestBugzillaAPIXMLRPCTransport,
TestExternalBugTracker,
)
+from lp.registry.interfaces.person import IPersonSet
+from lp.registry.interfaces.product import IProductSet
from lp.testing import (
TestCaseWithFactory,
ZopeTestInSubProcess,
=== modified file 'lib/lp/bugs/tests/test_bugtask_0.py'
--- lib/lp/bugs/tests/test_bugtask_0.py 2010-10-03 15:30:06 +0000
+++ lib/lp/bugs/tests/test_bugtask_0.py 2010-10-21 02:06:08 +0000
@@ -20,9 +20,9 @@
unresolved bugs (UNRESOLVED_BUGTASK_STATUSES). The two constants
include all statuses defined in BugTaskStatus, except for Unknown.
- >>> from canonical.launchpad.interfaces import (
- ... RESOLVED_BUGTASK_STATUSES, UNRESOLVED_BUGTASK_STATUSES)
- >>> from canonical.launchpad.interfaces import BugTaskStatus
+ >>> from lp.bugs.interfaces.bugtask import (
+ ... BugTaskStatus, RESOLVED_BUGTASK_STATUSES,
+ ... UNRESOLVED_BUGTASK_STATUSES)
>>> not_included_status = set(BugTaskStatus.items).difference(
... RESOLVED_BUGTASK_STATUSES + UNRESOLVED_BUGTASK_STATUSES)
>>> [status.name for status in not_included_status]
=== modified file 'lib/lp/codehosting/puller/tests/test_acceptance.py'
--- lib/lp/codehosting/puller/tests/test_acceptance.py 2010-10-04 19:50:45 +0000
+++ lib/lp/codehosting/puller/tests/test_acceptance.py 2010-10-21 02:06:08 +0000
@@ -28,13 +28,13 @@
from zope.security.proxy import removeSecurityProxy
from canonical.config import config
-from canonical.launchpad.interfaces import IScriptActivitySet
from canonical.testing.layers import ZopelessAppServerLayer
from lp.code.enums import BranchType
from lp.code.interfaces.branchtarget import IBranchTarget
from lp.codehosting.puller.tests import PullerBranchTestCase
from lp.codehosting.tests.helpers import LoomTestMixin
from lp.codehosting.vfs import get_lp_server
+from lp.services.scripts.interfaces.scriptactivity import IScriptActivitySet
class TestBranchPuller(PullerBranchTestCase, LoomTestMixin):
=== modified file 'lib/lp/codehosting/scanner/tests/test_buglinks.py'
--- lib/lp/codehosting/scanner/tests/test_buglinks.py 2010-10-04 13:55:16 +0000
+++ lib/lp/codehosting/scanner/tests/test_buglinks.py 2010-10-21 02:06:08 +0000
@@ -15,12 +15,10 @@
from zope.security.proxy import removeSecurityProxy
from canonical.config import config
-from canonical.launchpad.interfaces import (
- IBugBranchSet,
- IBugSet,
- )
from canonical.testing.layers import LaunchpadZopelessLayer
from lp.app.errors import NotFoundError
+from lp.bugs.interfaces.bug import IBugSet
+from lp.bugs.interfaces.bugbranch import IBugBranchSet
from lp.code.interfaces.revision import IRevisionSet
from lp.codehosting.scanner import events
from lp.codehosting.scanner.buglinks import BugBranchLinker
=== modified file 'lib/lp/codehosting/scanner/tests/test_mergedetection.py'
--- lib/lp/codehosting/scanner/tests/test_mergedetection.py 2010-10-08 20:25:27 +0000
+++ lib/lp/codehosting/scanner/tests/test_mergedetection.py 2010-10-21 02:06:08 +0000
@@ -16,7 +16,7 @@
from zope.event import notify
from canonical.config import config
-from canonical.launchpad.interfaces import IStore
+from canonical.launchpad.interfaces.lpstorm import IStore
from canonical.testing.layers import LaunchpadZopelessLayer
from lp.code.enums import (
BranchLifecycleStatus,
=== modified file 'lib/lp/codehosting/tests/servers.py'
--- lib/lp/codehosting/tests/servers.py 2010-10-04 13:55:16 +0000
+++ lib/lp/codehosting/tests/servers.py 2010-10-21 02:06:08 +0000
@@ -25,11 +25,13 @@
from canonical.config import config
from canonical.database.sqlbase import commit
from canonical.launchpad.daemons.tachandler import TacTestSetup
-from canonical.launchpad.interfaces import (
+from lp.registry.interfaces.person import (
IPersonSet,
+ TeamSubscriptionPolicy,
+ )
+from lp.registry.interfaces.ssh import (
ISSHKeySet,
SSHKeyType,
- TeamSubscriptionPolicy,
)
=== modified file 'lib/lp/coop/answersbugs/tests/test_doc.py'
--- lib/lp/coop/answersbugs/tests/test_doc.py 2010-10-04 19:50:45 +0000
+++ lib/lp/coop/answersbugs/tests/test_doc.py 2010-10-21 02:06:08 +0000
@@ -19,13 +19,6 @@
uploaderSetUp,
uploadQueueSetUp,
)
-from canonical.launchpad.interfaces import (
- CreateBugParams,
- IBugTaskSet,
- IDistributionSet,
- ILanguageSet,
- IPersonSet,
- )
from canonical.launchpad.testing.pages import PageTestSuite
from canonical.launchpad.testing.systemdocs import (
LayeredDocFileSuite,
@@ -36,7 +29,12 @@
DatabaseFunctionalLayer,
LaunchpadZopelessLayer,
)
+from lp.bugs.interfaces.bug import CreateBugParams
+from lp.bugs.interfaces.bugtask import IBugTaskSet
+from lp.registry.interfaces.distribution import IDistributionSet
+from lp.registry.interfaces.person import IPersonSet
from lp.services.testing import build_test_suite
+from lp.services.worlddata.interfaces.language import ILanguageSet
from lp.testing.mail_helpers import pop_notifications
=== modified file 'lib/lp/registry/tests/test_xmlrpc.py'
--- lib/lp/registry/tests/test_xmlrpc.py 2010-08-25 14:14:58 +0000
+++ lib/lp/registry/tests/test_xmlrpc.py 2010-10-21 02:06:08 +0000
@@ -12,8 +12,8 @@
from zope.security.proxy import removeSecurityProxy
from canonical.functional import XMLRPCTestTransport
-from canonical.launchpad.interfaces import IPrivateApplication
from canonical.launchpad.interfaces.account import AccountStatus
+from canonical.launchpad.interfaces.launchpad import IPrivateApplication
from canonical.launchpad.webapp.servers import LaunchpadTestRequest
from canonical.testing.layers import LaunchpadFunctionalLayer
from lp.registry.interfaces.person import (
=== modified file 'lib/lp/scripts/tests/test_garbo.py'
--- lib/lp/scripts/tests/test_garbo.py 2010-10-17 22:51:50 +0000
+++ lib/lp/scripts/tests/test_garbo.py 2010-10-21 02:06:08 +0000
@@ -32,13 +32,8 @@
from canonical.launchpad.database.message import Message
from canonical.launchpad.database.oauth import OAuthNonce
from canonical.launchpad.database.openidconsumer import OpenIDConsumerNonce
-from canonical.launchpad.interfaces import IMasterStore
from canonical.launchpad.interfaces.emailaddress import EmailAddressStatus
-from lp.scripts.garbo import (
- DailyDatabaseGarbageCollector,
- HourlyDatabaseGarbageCollector,
- OpenIDConsumerAssociationPruner,
- )
+from canonical.launchpad.interfaces.lpstorm import IMasterStore
from canonical.launchpad.scripts.logger import QuietFakeLogger
from canonical.launchpad.scripts.tests import run_script
from canonical.launchpad.webapp.interfaces import (
@@ -71,6 +66,11 @@
IPersonSet,
PersonCreationRationale,
)
+from lp.scripts.garbo import (
+ DailyDatabaseGarbageCollector,
+ HourlyDatabaseGarbageCollector,
+ OpenIDConsumerAssociationPruner,
+ )
from lp.services.job.model.job import Job
from lp.testing import (
TestCase,
=== modified file 'lib/lp/services/database/tests/test_prejoin.py'
--- lib/lp/services/database/tests/test_prejoin.py 2010-10-03 15:30:06 +0000
+++ lib/lp/services/database/tests/test_prejoin.py 2010-10-21 02:06:08 +0000
@@ -8,7 +8,7 @@
import unittest
-from canonical.launchpad.interfaces import IMasterStore
+from canonical.launchpad.interfaces.lpstorm import IMasterStore
from canonical.testing.layers import LaunchpadZopelessLayer
from lp.registry.model.person import Person
from lp.registry.model.product import Product
=== modified file 'lib/lp/services/features/browser/tests/test_feature_editor.py'
--- lib/lp/services/features/browser/tests/test_feature_editor.py 2010-09-29 07:37:38 +0000
+++ lib/lp/services/features/browser/tests/test_feature_editor.py 2010-10-21 02:06:08 +0000
@@ -6,39 +6,27 @@
__metaclass__ = type
-from testtools.matchers import (
- Equals,
- )
-
+from testtools.matchers import Equals
from zope.component import getUtility
from zope.security.interfaces import Unauthorized
-from canonical.launchpad.interfaces import (
- ILaunchpadCelebrities,
- ILaunchpadRoot,
- )
+from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
from canonical.launchpad.webapp import canonical_url
+from canonical.launchpad.webapp.interfaces import ILaunchpadRoot
from canonical.testing.layers import DatabaseFunctionalLayer
+from lp.services.features import get_relevant_feature_controller
+from lp.services.features.browser.edit import FeatureControlView
+from lp.services.features.rulesource import StormFeatureRuleSource
from lp.testing import (
BrowserTestCase,
- TestCase,
- TestCaseWithFactory,
celebrity_logged_in,
login_person,
person_logged_in,
+ TestCase,
+ TestCaseWithFactory,
time_counter,
)
-from lp.services.features import (
- get_relevant_feature_controller,
- )
-from lp.services.features.browser.edit import (
- FeatureControlView,
- )
-from lp.services.features.rulesource import (
- StormFeatureRuleSource,
- )
-
class TestFeatureControlPage(BrowserTestCase):
=== modified file 'lib/lp/soyuz/tests/test_doc.py'
--- lib/lp/soyuz/tests/test_doc.py 2010-10-04 19:50:45 +0000
+++ lib/lp/soyuz/tests/test_doc.py 2010-10-21 02:06:08 +0000
@@ -46,7 +46,7 @@
validity.
"""
from canonical.launchpad.database import EmailAddress
- from canonical.launchpad.interfaces import EmailAddressStatus
+ from canonical.launchpad.interfaces.emailaddress import EmailAddressStatus
stevea_emailaddress = EmailAddress.byEmail(
'steve.alexander@xxxxxxxxxxxxxxx')
stevea_emailaddress.status = EmailAddressStatus.NEW
=== modified file 'utilities/migrater/deglob.py'
--- utilities/migrater/deglob.py 2010-10-19 18:39:05 +0000
+++ utilities/migrater/deglob.py 2010-10-21 02:06:08 +0000
@@ -228,8 +228,39 @@
print " %(lineno)4s: %(text)s" % line
+def update_multi_python_globs_to_interfaces():
+ root = 'lib'
+ types = r'tests'
+ pattern = r'from canonical\.launchpad\.interfaces import'
+ substitution = True
+ for summary in find_matches(
+ root, types, pattern, substitution=substitution,
+ extract_match=multiline_extract_match):
+ print "\n%(file_path)s" % summary
+ for line in summary['lines']:
+ print " %(lineno)4s: %(text)s" % line
+
+
+def update_python_globs_to_interfaces():
+ root = 'lib'
+ types = r'tests'
+ globs = r'from \bcanonical\.launchpad\.interfaces import (\w+)$'
+ interfaces = get_interfaces(types=types, globs=globs)
+ interface_modules = get_interface_modules(interfaces)
+ glob_interface = r'\b(from canonical\.launchpad\.interfaces import %s)\b'
+ for interface, module_ in interface_modules.items():
+ pattern = glob_interface % interface
+ substitution = 'from %s import %s' % (module_, interface)
+ for summary in find_matches(
+ root, types, pattern, substitution=substitution):
+ print "\n%(file_path)s" % summary
+ for line in summary['lines']:
+ print " %(lineno)4s: %(text)s" % line
+
+
def main():
- normalize_all_doctest_imports()
+ update_multi_python_globs_to_interfaces()
+ update_python_globs_to_interfaces()
if __name__ == '__main__':