← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jcsackett/launchpad/these-tests-never-end into lp:launchpad

 

j.c.sackett has proposed merging lp:~jcsackett/launchpad/these-tests-never-end into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #792176 in Launchpad itself: "Missing yuitest integration"
  https://bugs.launchpad.net/launchpad/+bug/792176

For more details, see:
https://code.launchpad.net/~jcsackett/launchpad/these-tests-never-end/+merge/63588

Summary
=======
Several problems were discovered in our YUI tests. A number did not have the appropriate concluding syntax, and translations didn't have the test infrastructure to automatically link in the yui tests.

Preimplementation
=================
None; the required changes were listed in the bug.

Implementation
==============
lib/lp/registry/javascript/tests/personpicker.js
lib/lp/app/javascript/tests/test_hide_comment.js
lib/lp/translations/javascript/tests/test_sourcepackage_sharing_details.js
--------------------------------------------------------------------------
The necessary closing syntax listed in the bug was added to the end of each test file.

lib/lp/translations/windmill/testing.py
---------------------------------------
A YUI test layer was created for translations.

lib/lp/translations/windmill/test/test_yuitest.py
-------------------------------------------------
Test file cribbed from registry and updated to run the translations yui tests as part of windmill.

Tests
=====
To check that yui tests are run 
-------------------------------
bin/test -m lp.translations

To check the modified tests
---------------------------
firefox lib/lp/registry/javascript/tests/personpicker.js
firefox lib/lp/app/javascript/tests/test_hide_comment.js
firefox lib/lp/translations/javascript/tests/test_sourcepackage_sharing_details.js

QA
==
qa-untestable

Lint
====
= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/app/javascript/tests/test_hide_comment.js
  lib/lp/registry/javascript/tests/test_personpicker.js
  lib/lp/translations/javascript/tests/test_sourcepackage_sharing_details.js
  lib/lp/translations/windmill/testing.py
  lib/lp/translations/windmill/tests/test_yuitests.py

-- 
https://code.launchpad.net/~jcsackett/launchpad/these-tests-never-end/+merge/63588
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jcsackett/launchpad/these-tests-never-end into lp:launchpad.
=== modified file 'lib/lp/app/javascript/tests/test_hide_comment.js'
--- lib/lp/app/javascript/tests/test_hide_comment.js	2011-05-16 19:42:48 +0000
+++ lib/lp/app/javascript/tests/test_hide_comment.js	2011-06-06 17:32:21 +0000
@@ -81,6 +81,12 @@
         }));
 
     // Lock, stock, and two smoking barrels.
+    var handle_complete = function(data) {
+        status_node = Y.Node.create(
+            '<p id="complete">Test status: complete</p>');
+        Y.one('body').appendChild(status_node);
+    };
+    Y.Test.Runner.on('complete', handle_complete);
     Y.Test.Runner.add(suite);
 
     var console = new Y.Console({newestOnTop: false});

=== modified file 'lib/lp/registry/javascript/tests/test_personpicker.js'
--- lib/lp/registry/javascript/tests/test_personpicker.js	2011-05-31 21:18:08 +0000
+++ lib/lp/registry/javascript/tests/test_personpicker.js	2011-06-06 17:32:21 +0000
@@ -54,6 +54,12 @@
     }));
 
     // Lock, stock, and two smoking barrels.
+    var handle_complete = function(data) {
+        status_node = Y.Node.create(
+            '<p id="complete">Test status: complete</p>');
+        Y.one('body').appendChild(status_node);
+    };
+    Y.Test.Runner.on('complete', handle_complete);
     Y.Test.Runner.add(suite);
 
     var console = new Y.Console({newestOnTop: false});

=== modified file 'lib/lp/translations/javascript/tests/test_sourcepackage_sharing_details.js'
--- lib/lp/translations/javascript/tests/test_sourcepackage_sharing_details.js	2011-04-21 16:10:09 +0000
+++ lib/lp/translations/javascript/tests/test_sourcepackage_sharing_details.js	2011-06-06 17:32:21 +0000
@@ -338,6 +338,12 @@
     }));
 
     // Lock, stock, and two smoking barrels.
+    var handle_complete = function(data) {
+        status_node = Y.Node.create(
+            '<p id="complete">Test status: complete</p>');
+        Y.one('body').appendChild(status_node);
+    };
+    Y.Test.Runner.on('complete', handle_complete);
     Y.Test.Runner.add(suite);
 
     var console = new Y.Console({newestOnTop: false});

=== modified file 'lib/lp/translations/windmill/testing.py'
--- lib/lp/translations/windmill/testing.py	2011-04-05 00:47:45 +0000
+++ lib/lp/translations/windmill/testing.py	2011-06-06 17:32:21 +0000
@@ -6,10 +6,14 @@
 __metaclass__ = type
 __all__ = [
     'TranslationsWindmillLayer',
+    'TranslationsYUITestLayer',
     ]
 
 
-from canonical.testing.layers import BaseWindmillLayer
+from canonical.testing.layers import (
+    BaseWindmillLayer,
+    BaseYUITestLayer,
+    )
 
 
 class TranslationsWindmillLayer(BaseWindmillLayer):
@@ -21,3 +25,12 @@
         cls.base_url = cls.appserver_root_url(cls.facet)
         super(TranslationsWindmillLayer, cls).setUp()
 
+
+class TranslationsYUITestLayer(BaseYUITestLayer):
+    """Layer for Code YUI tests."""
+
+    @classmethod
+    def setUp(cls):
+        cls.base_url = cls.appserver_root_url()
+        super(TranslationsYUITestLayer, cls).setUp()
+

=== added file 'lib/lp/translations/windmill/tests/test_yuitests.py'
--- lib/lp/translations/windmill/tests/test_yuitests.py	1970-01-01 00:00:00 +0000
+++ lib/lp/translations/windmill/tests/test_yuitests.py	2011-06-06 17:32:21 +0000
@@ -0,0 +1,24 @@
+# Copyright 2011 Canonical Ltd.  This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+"""Run YUI.test tests."""
+
+__metaclass__ = type
+__all__ = []
+
+from lp.translations.windmill.testing import TranslationsYUITestLayer
+from lp.testing import (
+    build_yui_unittest_suite,
+    YUIUnitTestCase,
+    )
+
+
+class TranslationsYUIUnitTestCase(YUIUnitTestCase):
+
+    layer = TranslationsYUITestLayer 
+    suite_name = 'TranslationsYUIUnitTests'
+
+
+def test_suite():
+    app_testing_path = 'lp/translations/javascript/tests'
+    return build_yui_unittest_suite(app_testing_path, TranslationsYUIUnitTestCase)