Merge lp:~leonardr/lazr.restful/make-test-class-public into lp:lazr.restful
| Status: | Merged |
|---|---|
| Approved by: | Edwin Grubbs on 2010-03-04 |
| Approved revision: | 128 |
| Merged at revision: | not available |
| Proposed branch: | lp:~leonardr/lazr.restful/make-test-class-public |
| Merge into: | lp:lazr.restful |
| Prerequisite: | lp:~leonardr/lazr.restful/refactor-tag-request-with-version |
| Diff against target: |
377 lines (+147/-135) 2 files modified
src/lazr/restful/testing/webservice.py (+138/-3) src/lazr/restful/tests/test_webservice.py (+9/-132) |
| To merge this branch: | bzr merge lp:~leonardr/lazr.restful/make-test-class-public |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Edwin Grubbs (community) | code | 2010-03-03 | Approve on 2010-03-04 |
|
Review via email:
|
|||
| Leonard Richardson (leonardr) wrote : | # |
| Edwin Grubbs (edwin-grubbs) wrote : | # |
Hi Leonard,
The changes look good, but I got these errors when running the tests under python2.6. There were even more problems under python2.5.
-Edwin
Running lazr.restful.
Set up lazr.restful.
Set up lazr.restful.
Failure in test /home/egrubbs/
Traceback (most recent call last):
File "/usr/lib/
testMethod()
File "/usr/lib/
raise self.failureExc
AssertionError: Failed doctest test for field.txt
File "/home/
-------
File "/home/
Failed example:
print new_value
Differences (ndiff with -expected +actual):
- "http://
? ^^^^
+ "http:\
? + ^ +++++++
-------
File "/home/
Failed example:
print webservice(
Differences (ndiff with -expected +actual):
HTTP/1.1 209 Content Returned
- ...
+ Status: 209 Content Returned
+ Content-Length: 68
Content-Type: application/json
- ...
+ X-Powered-By: Zope (www.zope.org), Python (www.python.org)
<BLANKLINE>
- "http://
? ^^^
+ "http:\
? + + + ^^^^^^ +
Ran 9 tests with 1 failures and 0 errors in 2.391 seconds.
Running lazr.restful.
Tear down lazr.restful.
Tear down lazr.restful.
Set up lazr.restful.
Set up lazr.restful.
Ran 3 tests with 0 failures and 0 errors in 0.406 seconds.
Running lazr.restful.
Tear down lazr.restful.
Tear down lazr.restful.
Set up lazr.restful.
| Leonard Richardson (leonardr) wrote : | # |
I think you're running the tests on an old version of simplejson. Can you run some code to see what version of simplejson you have? Here's what I get:
$ bin/py
>>> import simplejson
>>> simplejson.
'2.0.9'
Also try making this change to setup.py, rerun bin/buildout, and see if the problem goes away.
=== modified file 'setup.py'
--- setup.py 2009-10-07 18:54:39 +0000
+++ setup.py 2010-03-04 14:03:26 +0000
@@ -64,7 +64,7 @@
- 'simplejson',
+ 'simplejson>
'wsgiref',
| Edwin Grubbs (edwin-grubbs) wrote : | # |
Hi Leonard,
Updating simplejson fixed it.
merge-approved
-Edwin

lazr.restful's unit test file test_webservice.py used to have a class called WebServiceTestCase that would set up a dummy web service and run some unit tests against it. Over time, the amount of setup work necessary increased, to the point where WSTC was basically setting up a fully functional web service.
When integrating a new lazr.restful version into Launchpad, I noticed that Launchpad also had unit tests that ran against a web service, and that I could save myself a lot of trouble by writing unit tests that subclassed WebServiceTestCase. I did this, but I pledged to come back and move WSTC (and its dependent classes) into lazr.restful. testing. webservice, so that Launchpad wouldn't be importing classes from a lazr.restful unit test module.
This branch does basically that, and nothing else. The one fix I made in passing was to change SimpleWebServic eConfiguration. createRequest to use the utility function tag_request_ with_version_ name(), replacing code that was basically a copy of tag_request_ with_version_ name. I also had to change the WADL unit tests, because I fleshed out the doctest strings of IGenericEntry and IGenericConfigu ration.