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

Proposed by Jonathan Lange
Status: Merged
Approved by: Robert Collins
Approved revision: no longer in the source branch.
Merged at revision: 12417
Proposed branch: lp:~jml/launchpad/more-canonical-cleanups
Merge into: lp:launchpad
Diff against target: 224 lines (+30/-23)
14 files modified
Makefile (+2/-2)
buildout-templates/bin/test.in (+2/-2)
lib/canonical/database/ftests/test_postgresql.py (+1/-1)
lib/canonical/ftests/__init__.py (+0/-4)
lib/canonical/launchpad/doc/batch_navigation.txt (+1/-1)
lib/canonical/launchpad/doc/old-testing.txt (+2/-2)
lib/canonical/launchpad/tests/test_sampledata.py (+1/-1)
lib/canonical/launchpad/webapp/adapter.py (+2/-2)
lib/canonical/testing/ftests/test_mockdb.py (+1/-2)
lib/canonical/testing/layers.py (+1/-1)
lib/lp/bugs/doc/bug.txt (+1/-1)
lib/lp/testing/pgsql.py (+3/-1)
lib/lp/testing/tests/test_pgsql.py (+4/-3)
lib/lp/tests/__init__.py (+9/-0)
To merge this branch: bzr merge lp:~jml/launchpad/more-canonical-cleanups
Reviewer Review Type Date Requested Status
Robert Collins (community) Approve
Review via email: mp+50448@code.launchpad.net

Commit message

[r=lifeless][no-qa] Move canonical.ftests and canonical.tests into the lp package.

Description of the change

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.

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

This raises a quandry for me. I have a branch that adds models for test runs and so on to lp.{something}; I can't use testing because it has support code for writing tests, and now I can't use 'tests' because that is actual tests. So where would I put my junk? Other than that question this branch is so trivial I think you should just land it.

review: Approve
Revision history for this message
Jonathan Lange (jml) wrote :

I don't quite understand your quandary. The current pattern, even before this branch, is to use testing for test support and tests for actual tests. It's by no means mandatory, but it seems to work, and anyway any category model is only a best guess until something new comes along.

Maybe it's because I don't understand what you mean by "models for test runs".

Revision history for this message
Robert Collins (lifeless) wrote :

On Sun, Feb 20, 2011 at 12:27 PM, Jonathan Lange <email address hidden> wrote:
> I don't quite understand your quandary. The current pattern, even before this branch, is to use testing for test support and tests for actual tests. It's by no means mandatory, but it seems to work, and anyway any category model is only a best guess until something new comes along.
>
> Maybe it's because I don't understand what you mean by "models for test runs".

The subunit table for now, but related work in the future.

Revision history for this message
Jonathan Lange (jml) wrote :

You mean testing functionality that's part of the application itself, rather than the scaffolding used to build the application?

Let's cross that bridge when we get to it.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2011-02-17 13:28:38 +0000
3+++ Makefile 2011-02-19 14:21:09 +0000
4@@ -79,10 +79,10 @@
5 check_merge: $(BUILDOUT_BIN)
6 [ `PYTHONPATH= bzr status -S database/schema/ | \
7 grep -v "\(^P\|pending\|security.cfg\|Makefile\|unautovacuumable\|_pythonpath.py\)" | wc -l` -eq 0 ]
8- ${PY} lib/canonical/tests/test_no_conflict_marker.py
9+ ${PY} lib/lp/tests/test_no_conflict_marker.py
10
11 check_db_merge: $(PY)
12- ${PY} lib/canonical/tests/test_no_conflict_marker.py
13+ ${PY} lib/lp/tests/test_no_conflict_marker.py
14
15 check_config: build
16 bin/test -m canonical.config.tests -vvt test_config
17
18=== modified file 'buildout-templates/bin/test.in'
19--- buildout-templates/bin/test.in 2011-01-28 22:42:12 +0000
20+++ buildout-templates/bin/test.in 2011-02-19 14:21:09 +0000
21@@ -155,8 +155,8 @@
22 # shortlist() raises an error when it is misused.
23 warnings.filterwarnings('error', r'shortlist\(\)')
24
25-from canonical.ftests import pgsql
26-# If this is removed, make sure canonical.ftests.pgsql is updated
27+from lp.testing import pgsql
28+# If this is removed, make sure lp.testing.pgsql is updated
29 # because the test harness there relies on the Connection wrapper being
30 # installed.
31 pgsql.installFakeConnect()
32
33=== modified file 'lib/canonical/database/ftests/test_postgresql.py'
34--- lib/canonical/database/ftests/test_postgresql.py 2010-10-17 05:02:20 +0000
35+++ lib/canonical/database/ftests/test_postgresql.py 2011-02-19 14:21:09 +0000
36@@ -5,7 +5,7 @@
37
38 from doctest import DocTestSuite
39
40-from canonical.ftests.pgsql import PgTestSetup
41+from lp.testing.pgsql import PgTestSetup
42
43 def setUp(test):
44
45
46=== removed directory 'lib/canonical/ftests'
47=== removed file 'lib/canonical/ftests/__init__.py'
48--- lib/canonical/ftests/__init__.py 2009-06-25 05:39:50 +0000
49+++ lib/canonical/ftests/__init__.py 1970-01-01 00:00:00 +0000
50@@ -1,4 +0,0 @@
51-# Copyright 2009 Canonical Ltd. This software is licensed under the
52-# GNU Affero General Public License version 3 (see the file LICENSE).
53-
54-# Package
55
56=== modified file 'lib/canonical/launchpad/doc/batch_navigation.txt'
57--- lib/canonical/launchpad/doc/batch_navigation.txt 2010-11-06 12:50:22 +0000
58+++ lib/canonical/launchpad/doc/batch_navigation.txt 2011-02-19 14:21:09 +0000
59@@ -55,7 +55,7 @@
60
61 Imports and initialization:
62
63- >>> from canonical.ftests.pgsql import CursorWrapper
64+ >>> from lp.testing.pgsql import CursorWrapper
65 >>> from canonical.launchpad.database.emailaddress import EmailAddress
66 >>> from canonical.launchpad.interfaces.lpstorm import IStore
67 >>> ignore = IStore(EmailAddress) # Prime the database connection.
68
69=== modified file 'lib/canonical/launchpad/doc/old-testing.txt'
70--- lib/canonical/launchpad/doc/old-testing.txt 2011-02-17 16:47:37 +0000
71+++ lib/canonical/launchpad/doc/old-testing.txt 2011-02-19 14:21:09 +0000
72@@ -25,9 +25,9 @@
73 For example, we would use this for testing SQLObject or our custom
74 extentions to it.
75
76-The class is defined in canonical.ftests.pgsql
77+The class is defined in lp.testing.pgsql
78
79->>> from canonical.ftests.pgsql import PgTestSetup
80+>>> from lp.testing.pgsql import PgTestSetup
81
82 The setup procedure builds us a fresh, empty database
83
84
85=== modified file 'lib/canonical/launchpad/tests/test_sampledata.py'
86--- lib/canonical/launchpad/tests/test_sampledata.py 2011-02-04 09:09:24 +0000
87+++ lib/canonical/launchpad/tests/test_sampledata.py 2011-02-19 14:21:09 +0000
88@@ -13,9 +13,9 @@
89
90 import subprocess
91
92-from canonical.ftests.pgsql import PgTestSetup
93 from canonical.testing.layers import DatabaseLayer
94 from lp.testing import TestCase
95+from lp.testing.pgsql import PgTestSetup
96
97
98 class SampleDataTestCase(TestCase):
99
100=== modified file 'lib/canonical/launchpad/webapp/adapter.py'
101--- lib/canonical/launchpad/webapp/adapter.py 2011-02-14 23:34:02 +0000
102+++ lib/canonical/launchpad/webapp/adapter.py 2011-02-19 14:21:09 +0000
103@@ -117,13 +117,13 @@
104
105 def _get_dirty_commit_flags():
106 """Return the current dirty commit status"""
107- from canonical.ftests.pgsql import ConnectionWrapper
108+ from lp.testing.pgsql import ConnectionWrapper
109 return (ConnectionWrapper.committed, ConnectionWrapper.dirty)
110
111
112 def _reset_dirty_commit_flags(previous_committed, previous_dirty):
113 """Set the dirty commit status to False unless previous is True"""
114- from canonical.ftests.pgsql import ConnectionWrapper
115+ from lp.testing.pgsql import ConnectionWrapper
116 if not previous_committed:
117 ConnectionWrapper.committed = False
118 if not previous_dirty:
119
120=== modified file 'lib/canonical/testing/ftests/test_mockdb.py'
121--- lib/canonical/testing/ftests/test_mockdb.py 2010-09-12 11:43:36 +0000
122+++ lib/canonical/testing/ftests/test_mockdb.py 2011-02-19 14:21:09 +0000
123@@ -95,7 +95,6 @@
124 dbconfig.rw_main_master, config.launchpad.dbuser)
125 if self.mode == 'direct':
126 con = psycopg2.connect(connection_string)
127- #con = canonical.ftests.pgsql._org_connect(connection_string)
128 else:
129 con = self.script.connect(psycopg2.connect, connection_string)
130 self.connections.append(con)
131@@ -336,7 +335,7 @@
132 con = self.connect()
133 con.close()
134 if mode == 'direct':
135- # canonical.ftests.pgsql's ConnectionWrapper
136+ # lp.testing.pgsql's ConnectionWrapper
137 # swallows exceptions in Rollback, which is wrong
138 # but will likely need to stay until we switch to Storm.
139 con.rollback()
140
141=== modified file 'lib/canonical/testing/layers.py'
142--- lib/canonical/testing/layers.py 2011-02-01 15:57:56 +0000
143+++ lib/canonical/testing/layers.py 2011-02-19 14:21:09 +0000
144@@ -95,7 +95,6 @@
145 from zope.server.logger.pythonlogger import PythonLogger
146 from zope.testing.testrunner.runner import FakeInputContinueGenerator
147
148-from canonical.ftests.pgsql import PgTestSetup
149 from canonical.launchpad.webapp.vhosts import allvhosts
150 from canonical.lazr import pidfile
151 from canonical.config import CanonicalConfig, config, dbconfig
152@@ -132,6 +131,7 @@
153 from canonical.testing.smtpd import SMTPController
154 from lp.services.memcache.client import memcache_client_factory
155 from lp.services.osutils import kill_by_pidfile
156+from lp.testing.pgsql import PgTestSetup
157
158
159 orig__call__ = zope.app.testing.functional.HTTPCaller.__call__
160
161=== modified file 'lib/lp/bugs/doc/bug.txt'
162--- lib/lp/bugs/doc/bug.txt 2011-02-16 20:06:40 +0000
163+++ lib/lp/bugs/doc/bug.txt 2011-02-19 14:21:09 +0000
164@@ -1119,7 +1119,7 @@
165 IBug.getMessagesForView() method allows you to get all the data needed to
166 show messages in the bugtask index template in one shot.
167
168- >>> from canonical.ftests.pgsql import CursorWrapper
169+ >>> from lp.testing.pgsql import CursorWrapper
170 >>> CursorWrapper.record_sql = True
171 >>> queries = len(CursorWrapper.last_executed_sql)
172
173
174=== renamed file 'lib/canonical/ftests/pgsql.py' => 'lib/lp/testing/pgsql.py'
175--- lib/canonical/ftests/pgsql.py 2011-01-05 11:21:01 +0000
176+++ lib/lp/testing/pgsql.py 2011-02-19 14:21:09 +0000
177@@ -16,7 +16,9 @@
178
179 from canonical.config import config
180 from canonical.database.postgresql import (
181- generateResetSequencesSQL, resetSequences)
182+ generateResetSequencesSQL,
183+ resetSequences,
184+ )
185
186
187 class ConnectionWrapper:
188
189=== renamed file 'lib/canonical/ftests/test_pgsql.py' => 'lib/lp/testing/tests/test_pgsql.py'
190--- lib/canonical/ftests/test_pgsql.py 2010-11-28 00:37:19 +0000
191+++ lib/lp/testing/tests/test_pgsql.py 2011-02-19 14:21:09 +0000
192@@ -9,13 +9,14 @@
193 )
194 import testtools
195
196-from canonical.config import config, dbconfig
197+from canonical.config import dbconfig
198 from canonical.config.fixture import ConfigUseFixture
199-from canonical.ftests.pgsql import (
200+from canonical.testing.layers import BaseLayer
201+
202+from lp.testing.pgsql import (
203 ConnectionWrapper,
204 PgTestSetup,
205 )
206-from canonical.testing.layers import BaseLayer
207
208
209 class TestPgTestSetup(testtools.TestCase, TestWithFixtures):
210
211=== renamed directory 'lib/canonical/tests' => 'lib/lp/tests'
212=== modified file 'lib/lp/tests/__init__.py'
213--- lib/canonical/tests/__init__.py 2005-10-31 18:29:12 +0000
214+++ lib/lp/tests/__init__.py 2011-02-19 14:21:09 +0000
215@@ -0,0 +1,9 @@
216+# Copyright 2011 Canonical Ltd. This software is licensed under the
217+# GNU Affero General Public License version 3 (see the file LICENSE).
218+
219+"""Tests for code-base sanity.
220+
221+Do not put tests for application logic in this package. Only tests that check
222+some project-wide phenomenon (such as there being no conflict markers in the
223+code base).
224+"""