Merge lp:~exarkun/divmod.org/nevow-test-fixes into lp:divmod.org

Proposed by Jean-Paul Calderone
Status: Merged
Approved by: Glyph Lefkowitz
Approved revision: 2700
Merged at revision: 2700
Proposed branch: lp:~exarkun/divmod.org/nevow-test-fixes
Merge into: lp:divmod.org
Diff against target: 43 lines (+14/-8)
2 files modified
Nevow/nevow/test/test_appserver.py (+13/-7)
Nevow/nevow/test/test_errorhandler.py (+1/-1)
To merge this branch: bzr merge lp:~exarkun/divmod.org/nevow-test-fixes
Reviewer Review Type Date Requested Status
Glyph Lefkowitz awesome Approve
Review via email: mp+141498@code.launchpad.net

Description of the change

Two small changes to the Nevow test suite to account for changes to Twisted which introduced test failures in Nevow's test suite.

To post a comment you must log in.
Revision history for this message
Glyph Lefkowitz (glyph) wrote :

1. Does nevow have continuous integration someplace? I'd love to see a green buildbot.

2. "# ugly :(" isn't really documentation. It'd be nice for there to be a function in the test module that actually does the private-attribute mangling so we could change the implementation later and so you could hang a docstring.

3. Does this change the required Twisted version? If so please document.

Other than #3, don't let this stop you from landing.

review: Approve (awesome)
2701. By Jean-Paul Calderone

Less ugly

Revision history for this message
Jean-Paul Calderone (exarkun) wrote :

> 1. Does nevow have continuous integration someplace? I'd love to see a green buildbot.

It doesn't. :/ The tests pass on my Ubuntu 12.04 laptop. :/ Do we have any options for continuous integration?

> 2. "# ugly :(" isn't really documentation.

Agreed...

> 3. Does this change the required Twisted version? If so please document.

It swaps a failing test on Twisted >= 11.0 for a failing test on Twisted < 11.0. Apart from the fact that tests passing is how you know whether things work (or work together), I don't think it changes which versions of Twisted Nevow supports.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Nevow/nevow/test/test_appserver.py'
2--- Nevow/nevow/test/test_appserver.py 2007-12-20 15:51:48 +0000
3+++ Nevow/nevow/test/test_appserver.py 2013-01-01 21:46:22 +0000
4@@ -170,14 +170,20 @@
5 assert proto.transport.disconnecting
6 return proto
7
8+
9+ def setSiteTime(self, when):
10+ """
11+ Forcibly override the current time as known by C{self.site}.
12+
13+ This relies on knowledge of private details of
14+ L{twisted.web.server.Site}. It would be nice if there were an API on
15+ that class for doing this more properly, to facilitate testing.
16+ """
17+ self.site._logDateTime = when
18+
19+
20 def test_oldStyle(self):
21- # need to try the new location first to make _logDateTime
22- # faking work
23- try:
24- from twisted.web import http
25- except ImportError:
26- from twisted.protocols import http
27- http._logDateTime = 'faketime' # ugly :(
28+ self.setSiteTime('faketime')
29 proto = self.renderResource('/foo')
30 logLines = proto.site.logFile.getvalue().splitlines()
31 self.assertEquals(len(logLines), 1)
32
33=== modified file 'Nevow/nevow/test/test_errorhandler.py'
34--- Nevow/nevow/test/test_errorhandler.py 2006-04-14 17:23:46 +0000
35+++ Nevow/nevow/test/test_errorhandler.py 2013-01-01 21:46:22 +0000
36@@ -79,7 +79,7 @@
37 def later((code, html)):
38 self.assertEquals(rend.FourOhFour.notFound, html)
39 self.assertEquals(code, 404)
40- fe = log.flushErrors(BrokenException)
41+ fe = self.flushLoggedErrors(BrokenException)
42 self.assertEquals(len(fe), 1)
43 return renderResource('/foo', notFoundHandler=BadNotFoundHandler()).addCallback(later)
44

Subscribers

People subscribed via source and target branches