launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #05418
[Merge] lp:~gary/launchpad/bug875697 into lp:launchpad
Gary Poster has proposed merging lp:~gary/launchpad/bug875697 into lp:launchpad with lp:~gary/launchpad/bug872089 as a prerequisite.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~gary/launchpad/bug875697/+merge/81219
This branch incorporates the changes I made to html5browser, allowing for per-test times, into the yuixhr tests. This means that each test will have 6 seconds to run. The test suite itself has a limit that should never be encountered of 5 minutes. The first test has a very generous 20 seconds to pass or fail, because it incorporates the time needed to fire up the test browser.
I use buildout for html5browser to make it easier to update safely and gradually across our environment. It still makes sense to include it as a deb dependency so we get its OS-level dependencies.
Lint is happy except for some pre-existing and pre-considered lines in yuixhr.py.
This depends on another branch because I can't land that one without this one--the tests time out on buildout.
--
https://code.launchpad.net/~gary/launchpad/bug875697/+merge/81219
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~gary/launchpad/bug875697 into lp:launchpad.
=== modified file 'lib/lp/app/javascript/server_fixture.js'
--- lib/lp/app/javascript/server_fixture.js 2011-11-03 23:25:28 +0000
+++ lib/lp/app/javascript/server_fixture.js 2011-11-03 23:25:28 +0000
@@ -71,6 +71,23 @@
window.status = '::::' + Y.JSON.stringify(data);
};
Y.Test.Runner.on('complete', handle_complete);
+ var handle_pass = function(data) {
+ window.status = '>>>>' + Y.JSON.stringify(
+ {testCase: data.testCase.name,
+ testName: data.testName,
+ type: data.type
+ });
+ };
+ Y.Test.Runner.on('pass', handle_pass);
+ var handle_fail = function(data) {
+ window.status = '>>>>' + Y.JSON.stringify(
+ {testCase: data.testCase.name,
+ testName: data.testName,
+ type: data.type,
+ error: data.error.getMessage()
+ });
+ };
+ Y.Test.Runner.on('fail', handle_fail);
Y.Test.Runner.add(suite);
var console = new Y.Console({newestOnTop: false});
=== modified file 'lib/lp/testing/__init__.py'
--- lib/lp/testing/__init__.py 2011-10-31 08:16:39 +0000
+++ lib/lp/testing/__init__.py 2011-11-03 23:25:28 +0000
@@ -827,7 +827,11 @@
layer = None
suite_name = ''
- js_timeout = 30000
+ # 30 seconds for the suite.
+ suite_timeout = 30000
+ # By default we do not restrict per-test or times. yuixhr tests do.
+ incremental_timeout = None
+ initial_timeout = None
html_uri = None
test_path = None
@@ -858,15 +862,21 @@
# twisted tests to break because of gtk's initialize.
import html5browser
client = html5browser.Browser()
- page = client.load_page(self.html_uri, timeout=self.js_timeout)
+ page = client.load_page(self.html_uri,
+ timeout=self.suite_timeout,
+ initial_timeout=self.initial_timeout,
+ incremental_timeout=self.incremental_timeout)
+ report = None
+ if page.content:
+ report = simplejson.loads(page.content)
if page.return_code == page.CODE_FAIL:
self._yui_results = self.TIMEOUT
+ self._last_test_info = report
return
# Data['type'] is complete (an event).
# Data['results'] is a dict (type=report)
# with 1 or more dicts (type=testcase)
# with 1 for more dicts (type=test).
- report = simplejson.loads(page.content)
if report.get('type', None) != 'complete':
# Did not get a report back.
self._yui_results = self.MISSING_REPORT
@@ -890,7 +900,19 @@
from here.
"""
if self._yui_results == self.TIMEOUT:
- self.fail("js timed out.")
+ msg = 'JS timed out.'
+ if self._last_test_info is not None:
+ try:
+ msg += (' The last test that ran to '
+ 'completion before timing out was '
+ '%(testCase)s:%(testName)s. The test %(type)sed.'
+ % self._last_test_info)
+ except KeyError:
+ pass
+ elif (self.incremental_timeout is not None or
+ self.initial_timeout is not None):
+ msg += ' The test may never have started.'
+ self.fail(msg)
elif self._yui_results == self.MISSING_REPORT:
self.fail("The data returned by js is not a test report.")
elif self._yui_results is None or len(self._yui_results) == 0:
=== modified file 'lib/lp/testing/yuixhr.py'
--- lib/lp/testing/yuixhr.py 2011-11-03 23:25:28 +0000
+++ lib/lp/testing/yuixhr.py 2011-11-03 23:25:28 +0000
@@ -433,6 +433,13 @@
layer = YUIAppServerLayer
_testMethodName = 'runTest'
+ # 5 minutes for the suite. Hopefully we never get close to this.
+ suite_timeout = 300000
+ # 6 seconds for each test. Hopefully they are three or less for
+ # yuixhr tests, and less than one for pure JS tests.
+ incremental_timeout = 6000
+ # 20 seconds for the first test, to include warmup time.
+ initial_timeout = 20000
def __init__(self, module_name, facet='mainsite'):
self.module_name = module_name
=== modified file 'setup.py'
--- setup.py 2011-10-26 02:14:52 +0000
+++ setup.py 2011-11-03 23:25:28 +0000
@@ -37,6 +37,7 @@
'FeedParser',
'feedvalidator',
'funkload',
+ 'html5browser',
'pygpgme',
'launchpadlib',
'lazr.batchnavigator',
=== modified file 'versions.cfg'
--- versions.cfg 2011-10-31 08:11:43 +0000
+++ versions.cfg 2011-11-03 23:25:28 +0000
@@ -23,6 +23,7 @@
functest = 0.8.7
funkload = 1.10.0
grokcore.component = 1.6
+html5browser = 0.0.9
httplib2 = 0.6.0
ipython = 0.9.1
iso8601 = 0.1.4