← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rvb/maas/update-sst into lp:maas

 

Raphaël Badin has proposed merging lp:~rvb/maas/update-sst into lp:maas.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~rvb/maas/update-sst/+merge/103130

This branch bumps the version of sst to 0.2.1.  This version fixes bug 943155 which means that SST now supports the usage of "file:///".  This branch cleans the code that created an http server to serve test html file (that was used to circumvent bug 943155.
-- 
https://code.launchpad.net/~rvb/maas/update-sst/+merge/103130
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/maas/update-sst into lp:maas.
=== modified file 'src/maasserver/tests/test_js.py'
--- src/maasserver/tests/test_js.py	2012-04-16 10:00:51 +0000
+++ src/maasserver/tests/test_js.py	2012-04-23 15:40:12 +0000
@@ -20,7 +20,6 @@
 import os
 import SimpleHTTPServer
 import SocketServer
-import threading
 
 from fixtures import Fixture
 from pyvirtualdisplay import Display
@@ -28,7 +27,6 @@
     assert_text,
     get_element,
     go_to,
-    set_base_url,
     start,
     stop,
     wait_for,
@@ -89,31 +87,6 @@
     log_error = lambda *args, **kwargs: None
 
 
-class StaticServerFixture(Fixture):
-    """Setup an HTTP server that will serve static files.
-
-    This is only required because SST forces us to request urls that start
-    with 'http://' (and thus does not allow us to use urls starting with
-    'file:///').
-    """
-
-    # Port used by the temporary http server used for testing.
-    TESTING_HTTP_PORT = 18463
-
-    port = TESTING_HTTP_PORT
-
-    def __init__(self):
-        self.server = ThreadingHTTPServer(
-            ('localhost', self.port), SilentHTTPRequestHandler)
-        self.server.daemon = True
-        self.server_thread = threading.Thread(target=self.server.serve_forever)
-
-    def setUp(self):
-        super(StaticServerFixture, self).setUp()
-        self.server_thread.start()
-        self.addCleanup(self.server.shutdown)
-
-
 class SSTFixture(Fixture):
     """Setup a javascript-enabled testing browser instance with SST."""
 
@@ -140,7 +113,6 @@
     def setUp(self):
         super(TestYUIUnitTests, self).setUp()
         self.useFixture(DisplayFixture())
-        self.port = self.useFixture(StaticServerFixture()).port
         self.useFixture(SSTFixture())
 
     def _get_failed_tests_message(self, results):
@@ -163,13 +135,15 @@
         return ''.join(result)
 
     def test_YUI3_unit_tests(self):
-        set_base_url('http://localhost:%d' % self.port)
         # Find all the HTML files in BASE_PATH.
+        project_home = os.path.dirname(
+            os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
         for fname in os.listdir(BASE_PATH):
             if fname.endswith('.html'):
                 # Load the page and then wait for #suite to contain
                 # 'done'.  Read the results in '#test_results'.
-                go_to("%s%s" % (BASE_PATH, fname))
+                file_path = os.path.join(project_home, BASE_PATH, fname)
+                go_to('file://%s' % file_path)
                 wait_for(assert_text, 'suite', 'done')
                 results = json.loads(get_element(id='test_results').text)
                 if results['failed'] != 0:

=== modified file 'versions.cfg'
--- versions.cfg	2012-04-18 15:14:17 +0000
+++ versions.cfg	2012-04-23 15:40:12 +0000
@@ -76,7 +76,7 @@
 
 # Added by Buildout Versions at 2012-02-24 16:56:06.100791
 PyVirtualDisplay = 0.0.9
-sst = 0.1.0
+sst = 0.2.1
 
 # Required by:
 # PyVirtualDisplay==0.0.9


Follow ups