← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jml/launchpad/more-canonical-cleanups into lp:launchpad

 

Jonathan Lange has proposed merging lp:~jml/launchpad/more-canonical-cleanups into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~jml/launchpad/more-canonical-cleanups/+merge/50448

Moves canonical.ftests into lp.testing, since the code there was about test support. Moves canonical.testing into lp.testing, since the code there is about whole-tree testing. Added some docstrings to clarify.
-- 
https://code.launchpad.net/~jml/launchpad/more-canonical-cleanups/+merge/50448
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jml/launchpad/more-canonical-cleanups into lp:launchpad.
=== modified file 'Makefile'
--- Makefile	2011-02-17 13:28:38 +0000
+++ Makefile	2011-02-19 14:19:56 +0000
@@ -79,10 +79,10 @@
 check_merge: $(BUILDOUT_BIN)
 	[ `PYTHONPATH= bzr status -S database/schema/ | \
 		grep -v "\(^P\|pending\|security.cfg\|Makefile\|unautovacuumable\|_pythonpath.py\)" | wc -l` -eq 0 ]
-	${PY} lib/canonical/tests/test_no_conflict_marker.py
+	${PY} lib/lp/tests/test_no_conflict_marker.py
 
 check_db_merge: $(PY)
-	${PY} lib/canonical/tests/test_no_conflict_marker.py
+	${PY} lib/lp/tests/test_no_conflict_marker.py
 
 check_config: build
 	bin/test -m canonical.config.tests -vvt test_config

=== modified file 'buildout-templates/bin/test.in'
--- buildout-templates/bin/test.in	2011-01-28 22:42:12 +0000
+++ buildout-templates/bin/test.in	2011-02-19 14:19:56 +0000
@@ -155,8 +155,8 @@
 # shortlist() raises an error when it is misused.
 warnings.filterwarnings('error', r'shortlist\(\)')
 
-from canonical.ftests import pgsql
-# If this is removed, make sure canonical.ftests.pgsql is updated
+from lp.testing import pgsql
+# If this is removed, make sure lp.testing.pgsql is updated
 # because the test harness there relies on the Connection wrapper being
 # installed.
 pgsql.installFakeConnect()

=== modified file 'lib/canonical/database/ftests/test_postgresql.py'
--- lib/canonical/database/ftests/test_postgresql.py	2010-10-17 05:02:20 +0000
+++ lib/canonical/database/ftests/test_postgresql.py	2011-02-19 14:19:56 +0000
@@ -5,7 +5,7 @@
 
 from doctest import DocTestSuite
 
-from canonical.ftests.pgsql import PgTestSetup
+from lp.testing.pgsql import PgTestSetup
 
 def setUp(test):
 

=== removed directory 'lib/canonical/ftests'
=== removed file 'lib/canonical/ftests/__init__.py'
--- lib/canonical/ftests/__init__.py	2009-06-25 05:39:50 +0000
+++ lib/canonical/ftests/__init__.py	1970-01-01 00:00:00 +0000
@@ -1,4 +0,0 @@
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-# Package

=== modified file 'lib/canonical/launchpad/doc/batch_navigation.txt'
--- lib/canonical/launchpad/doc/batch_navigation.txt	2010-11-06 12:50:22 +0000
+++ lib/canonical/launchpad/doc/batch_navigation.txt	2011-02-19 14:19:56 +0000
@@ -55,7 +55,7 @@
 
 Imports and initialization:
 
-  >>> from canonical.ftests.pgsql import CursorWrapper
+  >>> from lp.testing.pgsql import CursorWrapper
   >>> from canonical.launchpad.database.emailaddress import EmailAddress
   >>> from canonical.launchpad.interfaces.lpstorm import IStore
   >>> ignore = IStore(EmailAddress) # Prime the database connection.

=== modified file 'lib/canonical/launchpad/doc/old-testing.txt'
--- lib/canonical/launchpad/doc/old-testing.txt	2011-02-17 16:47:37 +0000
+++ lib/canonical/launchpad/doc/old-testing.txt	2011-02-19 14:19:56 +0000
@@ -25,9 +25,9 @@
 For example, we would use this for testing SQLObject or our custom
 extentions to it.
 
-The class is defined in canonical.ftests.pgsql
+The class is defined in lp.testing.pgsql
 
->>> from canonical.ftests.pgsql import PgTestSetup
+>>> from lp.testing.pgsql import PgTestSetup
 
 The setup procedure builds us a fresh, empty database
 

=== modified file 'lib/canonical/launchpad/tests/test_sampledata.py'
--- lib/canonical/launchpad/tests/test_sampledata.py	2011-02-04 09:09:24 +0000
+++ lib/canonical/launchpad/tests/test_sampledata.py	2011-02-19 14:19:56 +0000
@@ -13,9 +13,9 @@
 
 import subprocess
 
-from canonical.ftests.pgsql import PgTestSetup
 from canonical.testing.layers import DatabaseLayer
 from lp.testing import TestCase
+from lp.testing.pgsql import PgTestSetup
 
 
 class SampleDataTestCase(TestCase):

=== modified file 'lib/canonical/launchpad/webapp/adapter.py'
--- lib/canonical/launchpad/webapp/adapter.py	2011-02-14 23:34:02 +0000
+++ lib/canonical/launchpad/webapp/adapter.py	2011-02-19 14:19:56 +0000
@@ -117,13 +117,13 @@
 
 def _get_dirty_commit_flags():
     """Return the current dirty commit status"""
-    from canonical.ftests.pgsql import ConnectionWrapper
+    from lp.testing.pgsql import ConnectionWrapper
     return (ConnectionWrapper.committed, ConnectionWrapper.dirty)
 
 
 def _reset_dirty_commit_flags(previous_committed, previous_dirty):
     """Set the dirty commit status to False unless previous is True"""
-    from canonical.ftests.pgsql import ConnectionWrapper
+    from lp.testing.pgsql import ConnectionWrapper
     if not previous_committed:
         ConnectionWrapper.committed = False
     if not previous_dirty:

=== modified file 'lib/canonical/testing/ftests/test_mockdb.py'
--- lib/canonical/testing/ftests/test_mockdb.py	2010-09-12 11:43:36 +0000
+++ lib/canonical/testing/ftests/test_mockdb.py	2011-02-19 14:19:56 +0000
@@ -95,7 +95,6 @@
                     dbconfig.rw_main_master, config.launchpad.dbuser)
         if self.mode == 'direct':
             con = psycopg2.connect(connection_string)
-            #con = canonical.ftests.pgsql._org_connect(connection_string)
         else:
             con = self.script.connect(psycopg2.connect, connection_string)
         self.connections.append(con)
@@ -336,7 +335,7 @@
             con = self.connect()
             con.close()
             if mode == 'direct':
-                # canonical.ftests.pgsql's ConnectionWrapper
+                # lp.testing.pgsql's ConnectionWrapper
                 # swallows exceptions in Rollback, which is wrong
                 # but will likely need to stay until we switch to Storm.
                 con.rollback()

=== modified file 'lib/canonical/testing/layers.py'
--- lib/canonical/testing/layers.py	2011-02-01 15:57:56 +0000
+++ lib/canonical/testing/layers.py	2011-02-19 14:19:56 +0000
@@ -95,7 +95,6 @@
 from zope.server.logger.pythonlogger import PythonLogger
 from zope.testing.testrunner.runner import FakeInputContinueGenerator
 
-from canonical.ftests.pgsql import PgTestSetup
 from canonical.launchpad.webapp.vhosts import allvhosts
 from canonical.lazr import pidfile
 from canonical.config import CanonicalConfig, config, dbconfig
@@ -132,6 +131,7 @@
 from canonical.testing.smtpd import SMTPController
 from lp.services.memcache.client import memcache_client_factory
 from lp.services.osutils import kill_by_pidfile
+from lp.testing.pgsql import PgTestSetup
 
 
 orig__call__ = zope.app.testing.functional.HTTPCaller.__call__

=== modified file 'lib/lp/bugs/doc/bug.txt'
--- lib/lp/bugs/doc/bug.txt	2011-02-16 20:06:40 +0000
+++ lib/lp/bugs/doc/bug.txt	2011-02-19 14:19:56 +0000
@@ -1119,7 +1119,7 @@
 IBug.getMessagesForView() method allows you to get all the data needed to
 show messages in the bugtask index template in one shot.
 
-    >>> from canonical.ftests.pgsql import CursorWrapper
+    >>> from lp.testing.pgsql import CursorWrapper
     >>> CursorWrapper.record_sql = True
     >>> queries = len(CursorWrapper.last_executed_sql)
 

=== renamed file 'lib/canonical/ftests/pgsql.py' => 'lib/lp/testing/pgsql.py'
--- lib/canonical/ftests/pgsql.py	2011-01-05 11:21:01 +0000
+++ lib/lp/testing/pgsql.py	2011-02-19 14:19:56 +0000
@@ -16,7 +16,9 @@
 
 from canonical.config import config
 from canonical.database.postgresql import (
-    generateResetSequencesSQL, resetSequences)
+    generateResetSequencesSQL,
+    resetSequences,
+    )
 
 
 class ConnectionWrapper:

=== renamed file 'lib/canonical/ftests/test_pgsql.py' => 'lib/lp/testing/tests/test_pgsql.py'
--- lib/canonical/ftests/test_pgsql.py	2010-11-28 00:37:19 +0000
+++ lib/lp/testing/tests/test_pgsql.py	2011-02-19 14:19:56 +0000
@@ -9,13 +9,14 @@
     )
 import testtools
 
-from canonical.config import config, dbconfig
+from canonical.config import dbconfig
 from canonical.config.fixture import ConfigUseFixture
-from canonical.ftests.pgsql import (
+from canonical.testing.layers import BaseLayer
+
+from lp.testing.pgsql import (
     ConnectionWrapper,
     PgTestSetup,
     )
-from canonical.testing.layers import BaseLayer
 
 
 class TestPgTestSetup(testtools.TestCase, TestWithFixtures):

=== renamed directory 'lib/canonical/tests' => 'lib/lp/tests'
=== modified file 'lib/lp/tests/__init__.py'
--- lib/canonical/tests/__init__.py	2005-10-31 18:29:12 +0000
+++ lib/lp/tests/__init__.py	2011-02-19 14:19:56 +0000
@@ -0,0 +1,9 @@
+# Copyright 2011 Canonical Ltd.  This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+"""Tests for code-base sanity.
+
+Do not put tests for application logic in this package. Only tests that check
+some project-wide phenomenon (such as there being no conflict markers in the
+code base).
+"""