Merge lp:~sinzui/launchpad/enable-tests-0 into lp:launchpad

Proposed by Curtis Hovey
Status: Merged
Merged at revision: 11941
Proposed branch: lp:~sinzui/launchpad/enable-tests-0
Merge into: lp:launchpad
Diff against target: 232 lines (+78/-42)
7 files modified
lib/canonical/launchpad/doc/emailaddress.txt (+9/-7)
lib/lp/app/javascript/tests/test_lp_collapsibles.html (+6/-6)
lib/lp/app/javascript/tests/test_lp_collapsibles.js (+17/-9)
lib/lp/app/windmill/testing.py (+21/-0)
lib/lp/app/windmill/tests/test_yuitests.py (+24/-0)
lib/lp/registry/javascript/tests/test_milestone_table.html (+1/-1)
lib/lp/services/mailman/doc/postings.txt (+0/-19)
To merge this branch: bzr merge lp:~sinzui/launchpad/enable-tests-0
Reviewer Review Type Date Requested Status
Edwin Grubbs (community) code Approve
Benji York (community) code* Approve
Review via email: mp+41088@code.launchpad.net

Description of the change

This is my branch to enable broken tests.

    lp:~sinzui/launchpad/enable-tests-0
    Diff size: 233
    Launchpad bug:
        https://bugs.launchpad.net/bugs/488491
        https://bugs.launchpad.net/bugs/383615
        https://bugs.launchpad.net/bugs/318842
    Test command: ./bin/test -vv \
        -t '(app|registry)/.*test_yuitests'
        -t doc/emailaddress
    Test command: ./bin/test -vv --layer=Mailman -t postings
    Pre-implementation: no one
    Target release: 10.12

Enable broken tests
-------------------

Bug 488491 tests/test_lp_collapsibles fails
    The test was not updated propery when the module was moved and
    lazr.effects was added.

Bug 383615 Spurious test failure in emailaddress.txt
    The test was disabled because of a suprious failure. The failure though
    is in factory.makePerson() in setup (before the test has done anything).
    If there was a real problem, we would be seeing this very often. I know
    that makePerson and the rules for account have changed this year, so
    we should re-enable this.

Bug 318842 postings.txt can fail when run in a non-English locale
    The page test expects the English Mailman message

Rules
-----

Bug 488491 tests/test_lp_collapsibles fails
    * Fix the script and css imports in the harness (the html page)
    * Fix the imports in the js test
    * Fix the test broken by the switch to lazr.effects. the setup in
      test_toggle_collapsible_opens_collapsed_collapsible needs to use
      the lazr-close class. The collapsible script does not use the
      lazr-open class.
    * Fix _should.error. The test confused exceptions and assertions.
      _should.error checks for *exceptions*, but the collapsible script uses
      the fail assertion, which is an *event*. change _should.error to
      _should.fail to ensure something is listening for the event.
    * Add a yuitest harness so that the test is run in the test runner.

Bug 383615 Spurious test failure in emailaddress.txt
    * Rename the test
    * Update the imports that were not updated when modules were moved.

Bug 318842 postings.txt can fail when run in a non-English locale
    * Remove the body of the message, the header already states that the
      message was rejects.

Lint
----

Linting changed files:
  lib/canonical/launchpad/doc/emailaddress.txt
  lib/lp/app/windmill/
  lib/lp/app/javascript/tests/test_lp_collapsibles.html
  lib/lp/app/javascript/tests/test_lp_collapsibles.js
  lib/lp/app/windmill/__init__.py
  lib/lp/app/windmill/testing.py
  lib/lp/app/windmill/tests/
  lib/lp/app/windmill/tests/__init__.py
  lib/lp/app/windmill/tests/test_yuitests.py
  lib/lp/registry/javascript/tests/test_milestone_table.html
  lib/lp/services/mailman/doc/postings.txt

Test
----

Renamed the test and updated the imports:
    lib/canonical/launchpad/doc/emailaddress.txt

Fixed import, correct the setup for lazr.effects, and used _should.fail when
checking for assertion events.
    lib/lp/app/javascript/tests/test_lp_collapsibles.html
    lib/lp/app/javascript/tests/test_lp_collapsibles.js

Added a test harness to run the lp.app YUI unittests
    lib/lp/app/windmill/__init__.py
    lib/lp/app/windmill/testing.py
    lib/lp/app/windmill/tests/__init__.py
    lib/lp/app/windmill/tests/test_yuitests.py

Fixed the css import in the html test harness. (You can spot the failure
while watching the test log scroll)
    lib/lp/registry/javascript/tests/test_milestone_table.html

Removed the part localisable part of the message.
    lib/lp/services/mailman/doc/postings.txt

To post a comment you must log in.
Revision history for this message
Benji York (benji) wrote :

This branch looks good (Edwin, my mentor, will be reviewing this MP as well.).

I just have one question about this snippet:

=== modified file 'lib/lp/registry/javascript/tests/test_milestone_table.html'
--- lib/lp/registry/javascript/tests/test_milestone_table.html 2010-04-28 18:43:25 +0000
+++ lib/lp/registry/javascript/tests/test_milestone_table.html 2010-11-17 19:23:42 +0000
@@ -9,7 +9,7 @@
      <link rel="stylesheet" href="../../../../canonical/launchpad/icing/yui/cssreset/reset.css"/>
      <link rel="stylesheet" href="../../../../canonical/launchpad/icing/yui/cssfonts/fonts.css"/>
      <link rel="stylesheet" href="../../../../canonical/launchpad/icing/yui/cssbase/base.css"/>
    - <link rel="stylesheet" href="../../../canonical/launchpad/javascript/test.css" />
    + <link rel="stylesheet" href="../../../../canonical/launchpad/javascript/test.css" />

I notice the original (and your change) has self-closing tags both with
and without a space before the terminal forward slash. Is one preferred
over the other?

review: Approve (code*)
Revision history for this message
Curtis Hovey (sinzui) wrote :

On Wed, 2010-11-17 at 20:41 +0000, Benji York wrote:
> === modified file 'lib/lp/registry/javascript/tests/test_milestone_table.html'
> --- lib/lp/registry/javascript/tests/test_milestone_table.html 2010-04-28 18:43:25 +0000
> +++ lib/lp/registry/javascript/tests/test_milestone_table.html 2010-11-17 19:23:42 +0000
> @@ -9,7 +9,7 @@
> <link rel="stylesheet" href="../../../../canonical/launchpad/icing/yui/cssreset/reset.css"/>
> <link rel="stylesheet" href="../../../../canonical/launchpad/icing/yui/cssfonts/fonts.css"/>
> <link rel="stylesheet" href="../../../../canonical/launchpad/icing/yui/cssbase/base.css"/>
> - <link rel="stylesheet" href="../../../canonical/launchpad/javascript/test.css" />
> + <link rel="stylesheet" href="../../../../canonical/launchpad/javascript/test.css" />
>
> I notice the original (and your change) has self-closing tags both with
> and without a space before the terminal forward slash. Is one preferred
> over the other?

These is not. Older browsers choked on '<element attr="vale"/>' because
they were SGML-based. Even browsers that knew about xml would fault if
the an alternate parser was selected for the doctype.

I habitually add the space when working with markup that will appear in
a html page. I am old.

--
__Curtis C. Hovey_________
http://launchpad.net/

Revision history for this message
Edwin Grubbs (edwin-grubbs) wrote :

Hi Curtis,

I concur that this branch looks good.

-Edwin

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== renamed file 'lib/canonical/launchpad/doc/emailaddress.txt.disabled' => 'lib/canonical/launchpad/doc/emailaddress.txt'
2--- lib/canonical/launchpad/doc/emailaddress.txt.disabled 2009-08-13 19:03:36 +0000
3+++ lib/canonical/launchpad/doc/emailaddress.txt 2010-11-18 00:16:59 +0000
4@@ -1,4 +1,5 @@
5-= Email Addresses =
6+Email Addresses
7+===============
8
9 In Launchpad we use email addresses to uniquely identify a person. This is why
10 email addresses must be unique.
11@@ -22,7 +23,7 @@
12
13 Email addresses provide both IEmailAddress and IHasOwner.
14
15- >>> from canonical.launchpad.interfaces.launchpad import IHasOwner
16+ >>> from lp.registry.interfaces.role import IHasOwner
17 >>> verifyObject(IEmailAddress, email)
18 True
19 >>> verifyObject(IHasOwner, email)
20@@ -66,11 +67,12 @@
21 [u'celso.providelo@canonical.com', u'colin.watson@ubuntulinux.com',
22 u'daniel.silverstone@canonical.com', u'edgar@monteparadiso.hr',
23 u'foo.bar@canonical.com', u'jeff.waugh@ubuntulinux.com',
24- u'limi@plone.org', u'mark@example.com', u'steve.alexander@ubuntulinux.com',
25- u'support@ubuntu.com']
26-
27-
28-== Deleting email addresses ==
29+ u'limi@plone.org', u'mark@example.com',
30+ u'steve.alexander@ubuntulinux.com', u'support@ubuntu.com']
31+
32+
33+Deleting email addresses
34+------------------------
35
36 Email addresses may be deleted if they're not a person's preferred one
37 or the address of a team's mailing list.
38
39=== modified file 'lib/lp/app/javascript/tests/test_lp_collapsibles.html'
40--- lib/lp/app/javascript/tests/test_lp_collapsibles.html 2010-07-26 13:42:32 +0000
41+++ lib/lp/app/javascript/tests/test_lp_collapsibles.html 2010-11-18 00:16:59 +0000
42@@ -4,14 +4,14 @@
43 <title>Launchpad Collapsibles</title>
44
45 <!-- YUI 3.0 Setup -->
46- <script type="text/javascript" src="../../../icing/yui/yui/yui.js"></script>
47- <link rel="stylesheet" href="../../../icing/yui/cssreset/reset.css"/>
48- <link rel="stylesheet" href="../../../icing/yui/cssfonts/fonts.css"/>
49- <link rel="stylesheet" href="../../../icing/yui/cssbase/base.css"/>
50- <link rel="stylesheet" href="../../test.css" />
51+ <script type="text/javascript" src="../../../../canonical/launchpad/icing/yui/yui/yui.js"></script>
52+ <script type="text/javascript" src="../../../../canonical/launchpad/icing/lazr/build/lazr.js"></script>
53+ <link rel="stylesheet" href="../../../../canonical/launchpad/icing/yui/cssreset/reset.css"/>
54+ <link rel="stylesheet" href="../../../../canonical/launchpad/icing/yui/cssfonts/fonts.css"/>
55+ <link rel="stylesheet" href="../../../../canonical/launchpad/icing/yui/cssbase/base.css"/>
56+ <link rel="stylesheet" href="../../../../canonical/launchpad/javascript/test.css" />
57
58 <!-- The module under test -->
59- <script type="text/javascript" src="../../../icing/lazr/build/effects/effects.js"></script>
60 <script type="text/javascript" src="../lp.js"></script>
61
62 <!-- The test suite -->
63
64=== modified file 'lib/lp/app/javascript/tests/test_lp_collapsibles.js'
65--- lib/lp/app/javascript/tests/test_lp_collapsibles.js 2010-07-26 13:42:32 +0000
66+++ lib/lp/app/javascript/tests/test_lp_collapsibles.js 2010-11-18 00:16:59 +0000
67@@ -1,21 +1,21 @@
68 /* Copyright (c) 2009, Canonical Ltd. All rights reserved. */
69
70 YUI({
71- base: '../../../icing/yui/',
72+ base: '../../../../canonical/launchpad/icing/yui/',
73 filter: 'raw',
74 combine: false
75 }).use('test', 'console', 'lp', function(Y) {
76
77 var Assert = Y.Assert; // For easy access to isTrue(), etc.
78
79-Y.Test.Runner.add(new Y.Test.Case({
80+var suite = new Y.Test.Suite("Collapsibles Tests");
81+suite.add(new Y.Test.Case({
82 name: "activate_collapsibles",
83
84 _should: {
85- error: {
86+ fail: {
87 test_toggle_collapsible_fails_on_wrapperless_collapsible: true,
88 test_toggle_collapsible_fails_on_iconless_collapsible: true,
89- test_activate_collapsibles_handles_no_collapsibles: false
90 }
91 },
92
93@@ -149,17 +149,16 @@
94 test_toggle_collapsible_opens_collapsed_collapsible: function() {
95 // Calling toggle_collapsible() on a collapsed collapsible will
96 // toggle its state to open.
97+ Y.lp.activate_collapsibles();
98 var collapsible = this.container.one('.collapsible');
99- collapsible.addClass('collapsed');
100+ var wrapper_div = collapsible.one('.collapseWrapper');
101+ wrapper_div.addClass('lazr-closed');
102
103- Y.lp.activate_collapsibles();
104 Y.lp.toggle_collapsible(collapsible);
105 this.wait(function() {
106-
107 // The collapsible's wrapper div will now be open.
108 var icon = collapsible.one('img');
109- var wrapper_div = collapsible.one('.collapseWrapper');
110- Assert.isTrue(wrapper_div.hasClass('lazr-open'));
111+ Assert.isFalse(wrapper_div.hasClass('lazr-closed'));
112 Assert.areNotEqual(
113 -1, icon.get('src').indexOf('/@@/treeExpanded'));
114 }, 500);
115@@ -321,6 +320,15 @@
116 }
117 }));
118
119+// Lock, stock, and two smoking barrels.
120+var handle_complete = function(data) {
121+ status_node = Y.Node.create(
122+ '<p id="complete">Test status: complete</p>');
123+ Y.get('body').appendChild(status_node);
124+ };
125+Y.Test.Runner.on('complete', handle_complete);
126+Y.Test.Runner.add(suite);
127+
128 var yui_console = new Y.Console({
129 newestOnTop: false
130 });
131
132=== added directory 'lib/lp/app/windmill'
133=== added file 'lib/lp/app/windmill/__init__.py'
134=== added file 'lib/lp/app/windmill/testing.py'
135--- lib/lp/app/windmill/testing.py 1970-01-01 00:00:00 +0000
136+++ lib/lp/app/windmill/testing.py 2010-11-18 00:16:59 +0000
137@@ -0,0 +1,21 @@
138+# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
139+# GNU Affero General Public License version 3 (see the file LICENSE).
140+
141+"""Launchpad app specific testing infrastructure for Windmill."""
142+
143+__metaclass__ = type
144+__all__ = [
145+ 'AppWindmillLayer',
146+ ]
147+
148+
149+from canonical.testing.layers import BaseWindmillLayer
150+
151+
152+class AppWindmillLayer(BaseWindmillLayer):
153+ """Layer for App Windmill tests."""
154+
155+ @classmethod
156+ def setUp(cls):
157+ cls.base_url = cls.appserver_root_url()
158+ super(AppWindmillLayer, cls).setUp()
159
160=== added directory 'lib/lp/app/windmill/tests'
161=== added file 'lib/lp/app/windmill/tests/__init__.py'
162=== added file 'lib/lp/app/windmill/tests/test_yuitests.py'
163--- lib/lp/app/windmill/tests/test_yuitests.py 1970-01-01 00:00:00 +0000
164+++ lib/lp/app/windmill/tests/test_yuitests.py 2010-11-18 00:16:59 +0000
165@@ -0,0 +1,24 @@
166+# Copyright 2010 Canonical Ltd. This software is licensed under the
167+# GNU Affero General Public License version 3 (see the file LICENSE).
168+
169+"""Run YUI.test tests."""
170+
171+__metaclass__ = type
172+__all__ = []
173+
174+from lp.app.windmill.testing import AppWindmillLayer
175+from lp.testing import (
176+ build_yui_unittest_suite,
177+ YUIUnitTestCase,
178+ )
179+
180+
181+class AppYUIUnitTestCase(YUIUnitTestCase):
182+
183+ layer = AppWindmillLayer
184+ suite_name = 'AppYUIUnitTests'
185+
186+
187+def test_suite():
188+ app_testing_path = 'lp/app/javascript/tests'
189+ return build_yui_unittest_suite(app_testing_path, AppYUIUnitTestCase)
190
191=== modified file 'lib/lp/registry/javascript/tests/test_milestone_table.html'
192--- lib/lp/registry/javascript/tests/test_milestone_table.html 2010-04-28 18:43:25 +0000
193+++ lib/lp/registry/javascript/tests/test_milestone_table.html 2010-11-18 00:16:59 +0000
194@@ -9,7 +9,7 @@
195 <link rel="stylesheet" href="../../../../canonical/launchpad/icing/yui/cssreset/reset.css"/>
196 <link rel="stylesheet" href="../../../../canonical/launchpad/icing/yui/cssfonts/fonts.css"/>
197 <link rel="stylesheet" href="../../../../canonical/launchpad/icing/yui/cssbase/base.css"/>
198- <link rel="stylesheet" href="../../../canonical/launchpad/javascript/test.css" />
199+ <link rel="stylesheet" href="../../../../canonical/launchpad/javascript/test.css" />
200
201 <!-- The module under test -->
202 <script type="text/javascript" src="../milestonetable.js"></script>
203
204=== modified file 'lib/lp/services/mailman/doc/postings.txt'
205--- lib/lp/services/mailman/doc/postings.txt 2010-10-25 12:11:43 +0000
206+++ lib/lp/services/mailman/doc/postings.txt 2010-11-18 00:16:59 +0000
207@@ -177,25 +177,6 @@
208 From: itest-one-...@lists.launchpad.dev
209 To: anne.person@example.com
210 ...
211- Sender: itest-one-bounces+anne.person=example.com@lists.launchpad.dev
212- Errors-To: itest-one-bounces+anne.person=example.com@lists.launchpad.dev
213- ...
214- X-MailFrom: itest-one-bounces+anne.person=example.com@lists.launchpad.dev
215- X-RcptTo: anne.person@example.com
216- <BLANKLINE>
217- Your request to the Itest-one mailing list
218- <BLANKLINE>
219- Posting of your message titled "An unsubscribed post"
220- <BLANKLINE>
221- has been rejected by the list moderator. The moderator gave the
222- following reason for rejecting your request:
223- <BLANKLINE>
224- "[No reason given]"
225- <BLANKLINE>
226- Any questions or comments should be directed to the list administrator
227- at:
228- <BLANKLINE>
229- itest-one-owner@lists.launchpad.dev
230
231 Anne posts another message to the mailing list, but she is still not
232 subscribed to it. The team administrator deems this message to be spam and