Merge lp:~gary/lazr.restful/fix-webservice-testing-infrastructure into lp:lazr.restful

Proposed by Gary Poster
Status: Merged
Merged at revision: not available
Proposed branch: lp:~gary/lazr.restful/fix-webservice-testing-infrastructure
Merge into: lp:lazr.restful
Diff against target: None lines
To merge this branch: bzr merge lp:~gary/lazr.restful/fix-webservice-testing-infrastructure
Reviewer Review Type Date Requested Status
Leonard Richardson (community) Needs Information
Review via email: mp+10624@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Gary Poster (gary) wrote :

Fixes testing infrastructure and packaging problems.

Revision history for this message
Leonard Richardson (leonardr) wrote :

> Fixes testing infrastructure and packaging problems.

I have two comments.

1. Why the heck is 'roman' a dependency of lazr.restful? It's not in the code and it's such a random thing to need.

2. This comment isn't terribly helpful.

70 + # We want the initial slash of the path, so we subtract 1 from
71 + # the base_url's len.

I'd prefer something like:

# We want just one character of the base_url (the slash that begins the path), so we cut
# off the length of the base_url minus one character.

review: Needs Information
62. By Gary Poster

the missing roman dependency was because my copy of docutils had been built with a Python that had roman, and docutils tries to be clever so that meant the egg was broken for a Python without roman. removing dependency.

63. By Gary Poster

make a better comment, per review by leonardr

Revision history for this message
Gary Poster (gary) wrote :

On Aug 25, 2009, at 8:29 AM, Leonard Richardson wrote:

> Review: Needs Information
>> Fixes testing infrastructure and packaging problems.
>
> I have two comments.
>
> 1. Why the heck is 'roman' a dependency of lazr.restful? It's not in
> the code and it's such a random thing to need.

I was surprised too, but my tests failed in a clean Python (that is, a
vanilla Python with only the standard library) without it. That said,
I investigated further after you asked. It turns out that docutils
tries to do something tricky, and my version of docutils had broken
the trick. I rebuilt docutils and we're all good. Therefore, I
removed that indirect dependency from the list.

> 2. This comment isn't terribly helpful.
>
> 70 + # We want the initial slash of the path, so we subtract 1 from
> 71 + # the base_url's len.
>
> I'd prefer something like:
>
> # We want just one character of the base_url (the slash that begins
> the path), so we cut
> # off the length of the base_url minus one character.

Yes, good improvement. I took it a little further, as you can see in
the incremental diff below.

Thanks

Gary

=== modified file 'setup.py'
--- setup.py 2009-08-20 04:18:09 +0000
+++ setup.py 2009-08-25 13:46:54 +0000
@@ -61,7 +61,6 @@
          'lazr.enum',
          'lazr.lifecycle',
          'lazr.uri',
- 'roman',
          'setuptools',
          'simplejson',
          'van.testing',

=== modified file 'src/lazr/restful/testing/webservice.py'
--- src/lazr/restful/testing/webservice.py 2009-08-20 04:18:09 +0000
+++ src/lazr/restful/testing/webservice.py 2009-08-25 14:04:09 +0000
@@ -211,8 +211,9 @@
                          'preceding slash?)',
                          path_or_url)
              else:
- # We want the initial slash of the path, so we
subtract 1 from
- # the base_url's len.
+ # The base_url ends with a slash. We want that slash
to begin
+ # the path, so we cut off the length of the base_url
minus one
+ # character.
                  full_url = path_or_url[len(base_url)-1:]
          full_headers = {'Host': self.domain}
          if headers is not None:

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'MANIFEST.in'
2--- MANIFEST.in 2009-03-23 19:17:56 +0000
3+++ MANIFEST.in 2009-08-20 12:23:08 +0000
4@@ -1,2 +1,4 @@
5+include ez_setup.py
6+recursive-include src *.txt *.pt *.zcml
7 exclude MANIFEST.in buildout.cfg bootstrap.py .bzrignore
8 prune _bootstrap
9
10=== modified file 'setup.py'
11--- setup.py 2009-08-14 20:25:45 +0000
12+++ setup.py 2009-08-20 04:18:09 +0000
13@@ -61,6 +61,7 @@
14 'lazr.enum',
15 'lazr.lifecycle',
16 'lazr.uri',
17+ 'roman',
18 'setuptools',
19 'simplejson',
20 'van.testing',
21
22=== modified file 'src/lazr/restful/NEWS.txt'
23--- src/lazr/restful/NEWS.txt 2009-08-19 17:17:30 +0000
24+++ src/lazr/restful/NEWS.txt 2009-08-20 04:45:22 +0000
25@@ -15,6 +15,11 @@
26 For services that use Django, added an adapter from Django's
27 ObjectDoesNotExist to lazr.restful's NotFoundView.
28
29+Fixed some testing infrastructure in lazr.restful.testing.webservice.
30+
31+Added "roman" to build dependencies.
32+
33+Fix some critical packaging problems.
34
35 0.9.4 (2009-08-17)
36 ==================
37
38=== modified file 'src/lazr/restful/testing/webservice.py'
39--- src/lazr/restful/testing/webservice.py 2009-08-18 15:47:10 +0000
40+++ src/lazr/restful/testing/webservice.py 2009-08-20 04:18:09 +0000
41@@ -8,7 +8,6 @@
42 'ExampleWebServicePublication',
43 'FakeRequest',
44 'FakeResponse',
45- 'MockRootFolder',
46 'pprint_entry',
47 'WebServiceTestPublication',
48 'WebServiceTestRequest',
49@@ -183,7 +182,7 @@
50 # /firefox = http://foo.dev/firefox
51 # /firefox = http://api.foo.dev/beta/firefox
52 resource_path = resource_path[1:]
53- url_with_version = '/'.join(api_version, resource_path)
54+ url_with_version = '/'.join((api_version, resource_path))
55 return urljoin(self.base_url, url_with_version)
56
57 def addHeadersTo(self, url, headers):
58@@ -206,9 +205,15 @@
59 else:
60 base_url = self.base_url
61 if not path_or_url.startswith(base_url):
62- raise ValueError('not a testing url', path_or_url)
63+ raise ValueError(
64+ 'not a testing url '
65+ '(maybe you wanted a relative url but left off the '
66+ 'preceding slash?)',
67+ path_or_url)
68 else:
69- full_url = path_or_url[len(base_url):]
70+ # We want the initial slash of the path, so we subtract 1 from
71+ # the base_url's len.
72+ full_url = path_or_url[len(base_url)-1:]
73 full_headers = {'Host': self.domain}
74 if headers is not None:
75 full_headers.update(headers)
76@@ -354,4 +359,3 @@
77 def __str__(self):
78 return "http://dummy"
79 __call__ = __str__
80-
81
82=== modified file 'src/lazr/restful/version.txt'
83--- src/lazr/restful/version.txt 2009-08-17 16:24:44 +0000
84+++ src/lazr/restful/version.txt 2009-08-20 04:18:09 +0000
85@@ -1,1 +1,1 @@
86-0.9.4
87+0.9.5

Subscribers

People subscribed via source and target branches