I ran python bootstrap.py && ./bin/buildout && ./bin/test and found that test_no_credentials_calls_get_token_and_login
was failing, as it was expecting the "beta" webservice, when 1.0 is default. This is bug 488448.
I didn't see the failures I was seeing when using in launchpad, and so dicsovered
that ./bin/test doesn't run any of the doctests, and I think this may mean that the tests
haven't been getting exercised.
Writing a small test_docs.py to load the doctests I was able to run them.
This led to lots of problems.
Lots of this:
Traceback (most recent call last):
File "/usr/lib/python2.6/doctest.py", line 1248, in __run compileflags, 1) in test.globs
File "<doctest people.txt[6]>", line 1, in <module>
me = launchpad.me
File "/home/jw2328/devel/launchpadlib/launchpadlib/launchpadlib/eggs/lazr.restfulclient-0.9.20-py2.6.egg/lazr/restfulclient/resource.py", line 305, in __getattr__
return self.lp_get_parameter(attr)
File "/home/jw2328/devel/launchpadlib/launchpadlib/launchpadlib/eggs/lazr.restfulclient-0.9.20-py2.6.egg/lazr/restfulclient/resource.py", line 206, in lp_get_parameter linked_resource = param.linked_resource
File "/home/jw2328/devel/launchpadlib/launchpadlib/launchpadlib/eggs/wadllib-1.1.4-py2.6.egg/wadllib/application.py", line 928, in linked_resource
return Link(self, link_tag).resolve_definition()
File "/home/jw2328/devel/launchpadlib/launchpadlib/launchpadlib/eggs/wadllib-1.1.4-py2.6.egg/wadllib/application.py", line 217, in resolve_definition
xml_id = self.application.lookup_xml_id(object_url)
File "/home/jw2328/devel/launchpadlib/launchpadlib/launchpadlib/eggs/wadllib-1.1.4-py2.6.egg/wadllib/application.py", line 1080, in lookup_xml_id
"url (%s) are: %s requested: %s" % (url, this_uri, markup_uri))
NotImplementedError: Can't look up definition in another url (https://api.launchpad.dev/1.0/#person)
because it is comparing a https scheme with no port with a http scheme with a port.
Hi,
While trying to land the launchpadlib update in to Launchpad itself, I ran in to test failures
with the latest release.
Confused I went to try and reproduce in lp:launchpadlib.
I ran python bootstrap.py && ./bin/buildout && ./bin/test and found that test_no_ credentials_ calls_get_ token_and_ login
was failing, as it was expecting the "beta" webservice, when 1.0 is default. This is bug 488448.
I didn't see the failures I was seeing when using in launchpad, and so dicsovered
that ./bin/test doesn't run any of the doctests, and I think this may mean that the tests
haven't been getting exercised.
Writing a small test_docs.py to load the doctests I was able to run them.
This led to lots of problems.
Lots of this:
Traceback (most recent call last): python2. 6/doctest. py", line 1248, in __run
compileflags, 1) in test.globs jw2328/ devel/launchpad lib/launchpadli b/launchpadlib/ eggs/lazr. restfulclient- 0.9.20- py2.6.egg/ lazr/restfulcli ent/resource. py", line 305, in __getattr__ get_parameter( attr) jw2328/ devel/launchpad lib/launchpadli b/launchpadlib/ eggs/lazr. restfulclient- 0.9.20- py2.6.egg/ lazr/restfulcli ent/resource. py", line 206, in lp_get_parameter
linked_ resource = param.linked_ resource jw2328/ devel/launchpad lib/launchpadli b/launchpadlib/ eggs/wadllib- 1.1.4-py2. 6.egg/wadllib/ application. py", line 928, in linked_resource .resolve_ definition( ) jw2328/ devel/launchpad lib/launchpadli b/launchpadlib/ eggs/wadllib- 1.1.4-py2. 6.egg/wadllib/ application. py", line 217, in resolve_definition n.lookup_ xml_id( object_ url) jw2328/ devel/launchpad lib/launchpadli b/launchpadlib/ eggs/wadllib- 1.1.4-py2. 6.egg/wadllib/ application. py", line 1080, in lookup_xml_id tedError: Can't look up definition in another url (https:/ /api.launchpad. dev/1.0/ #person)
File "/usr/lib/
File "<doctest people.txt[6]>", line 1, in <module>
me = launchpad.me
File "/home/
return self.lp_
File "/home/
File "/home/
return Link(self, link_tag)
File "/home/
xml_id = self.applicatio
File "/home/
"url (%s) are: %s requested: %s" % (url, this_uri, markup_uri))
NotImplemen
because it is comparing a https scheme with no port with a http scheme with a port.
Then this:
len( mugshot. open(). read()) localhost: 58000/. ../image. png mugshot HTTP/1.1\r\nHost: api.launchpad. dev\r\nAuthoriz ation: OAuth realm="OAuth", oauth_nonce= "66322799" , oauth_timestamp ="1279141663" , oauth_consumer_ key="launchpad- library" , oauth_signature _method= "PLAINTEXT" , oauth_version= "1.0", oauth_token= "salgado- change- anything" , oauth_signature ="%26test" \r\naccept- encoding: gzip, deflate\r\naccept: application/ json\r\ nuser-agent: lazr.restfulclient 0.9.20; oauth_consumer= "launchpad- library" \r\n\r\ n' Type-Warning: guessed from content launchpad. dev:58080/ 94/image. png Accept- Encoding
Expected:
send: ...
reply: 'HTTP/1.1 303 See Other...
header: Location: http://
...
header: Content-Type: text/plain
2260
Got:
send: 'GET /1.0/~salgado/
reply: 'HTTP/1.1 303 See Other\r\n'
header: Date: Wed, 14 Jul 2010 21:07:43 GMT
header: Server: zope.server.http (DebugLayerHTTP)
header: X-Powered-By: Zope (www.zope.org), Python (www.python.org)
header: X-Content-
header: Location: http://
header: Vary: Accept,
header: Content-Type: text/plain
header: Via: 1.1 launchpad.dev
header: Content-Encoding: gzip
header: Content-Length: 20
2260
which is apparently because the librarian now sits on launchpad.dev:58080 rather than
localhost:58000
Then this:
File "/home/ jw2328/ devel/launchpad lib/launchpadli b/launchpadlib/ src/launchpadli b/tests/ ../docs/ people. txt", line 49, in people.txt people[ 'not-a- registered- person' ] registered- person' python2. 6/doctest. py", line 1248, in __run
compileflags, 1) in test.globs
launchpad. people[ 'not-a- registered- person' ] jw2328/ devel/launchpad lib/launchpadli b/launchpadlib/ eggs/lazr. restfulclient- 0.9.20- py2.6.egg/ lazr/restfulcli ent/resource. py", line 628, in __repr__
URI(self. resource_ type_link) .fragment, self.self_link) jw2328/ devel/launchpad lib/launchpadli b/launchpadlib/ eggs/lazr. restfulclient- 0.9.20- py2.6.egg/ lazr/restfulcli ent/resource. py", line 643, in __getattr__ _getattr_ _(name) jw2328/ devel/launchpad lib/launchpadli b/launchpadlib/ eggs/lazr. restfulclient- 0.9.20- py2.6.egg/ lazr/restfulcli ent/resource. py", line 305, in __getattr__ get_parameter( attr) jw2328/ devel/launchpad lib/launchpadli b/launchpadlib/ eggs/lazr. restfulclient- 0.9.20- py2.6.egg/ lazr/restfulcli ent/resource. py", line 196, in lp_get_parameter
self._ ensure_ representation( ) jw2328/ devel/launchpad lib/launchpadli b/launchpadlib/ eggs/lazr. restfulclient- 0.9.20- py2.6.egg/ lazr/restfulcli ent/resource. py", line 331, in _ensure_ representation
representation = self._root. _browser. get(self. _wadl_resource) jw2328/ devel/launchpad lib/launchpadli b/launchpadlib/ eggs/lazr. restfulclient- 0.9.20- py2.6.egg/ lazr/restfulcli ent/_browser. py", line 287, in get headers) jw2328/ devel/launchpad lib/launchpadli b/launchpadlib/ eggs/lazr. restfulclient- 0.9.20- py2.6.egg/ lazr/restfulcli ent/_browser. py", line 277, in _request launchpad. systemhomes. WebServiceAppli cation object at 0xc3a806c>, name: u'~not- a-registered- person' jw2328/ devel/lp- sourcedeps/ eggs/zope. publisher- 3.10.0- py2.6.egg/ zope/publisher/ publish. py", line 131, in publish traverse( obj) jw2328/ devel/lp- sourcedeps/ eggs/lazr. restful- 0.9.29- py2.6.egg/ lazr/restful/ publisher. py", line 227, in traverse eRequestTravers al, self).traverse(ob) jw2328/ devel/lp- sourcedeps/ eggs/zope. publisher- 3.10.0- py2.6.egg/ zope/publisher/ browser. py", line 542, in traverse quest, self).traverse(obj) jw2328/ devel/lp- sourcedeps/ eggs/zope. publisher- 3.10.0- py2.6.egg/ zope/publisher/ http.py" , line 456, in traverse jw2328/ devel/lp- sourcedeps/ eggs/zope. publisher- 3.10.0- py2.6.egg/ zope/publisher/ base.py" , line 261, in traverse traverseName( self, obj, entry_name) jw2328/ devel/lp- sourcedeps/ eggs/lazr. restful- 0.9.29- py2.6.egg/ lazr/restful/ publisher. py", line 97, in traverseName jw2328/ devel/lp- sourcedeps/ eggs/zope. app.publication -3.9.0- py2.6.egg/ zope/app/ publication/ zopepublication .py", line 197, in traverseName publishTraverse (request, nm) jw2328/ devel/launchpad /expose- blueprints/ lib/canonical/ launchpad/ browser/ launchpad. py", line 735, in publishTraverse publishTraverse (self, request, name) jw2328/ devel/launchpad /expose- blueprints/ lib/canonical/ launchpad/ webapp/ publisher. py", line 615, in publishTraverse averse( request, name) jw2328/ devel/launchpad /expose- blueprints/ lib/canonical/ launchpad/ webapp/ publisher. py", line 739, in _publishTraverse next_object( nextobj, request, name) jw2328/ devel/launchpad /expose- blueprints/ lib/canonical/ launchpad/ webapp/ publisher. py", line 645, in _handle_next_object self.context, name) launchpad. systemhomes. WebServiceAppli cation object at 0xc3a806c>, name: u'~not- a-registered- person'
Failed example:
launchpad.
Expected:
Traceback (most recent call last):
...
KeyError: 'not-a-
Got:
Traceback (most recent call last):
File "/usr/lib/
File "<doctest people.txt[12]>", line 1, in <module>
File "/home/
File "/home/
return super(Entry, self)._
File "/home/
return self.lp_
File "/home/
File "/home/
File "/home/
response, content = self._request(url, extra_headers=
File "/home/
raise HTTPError(response, content)
HTTPError: HTTP Error 404: Not Found
Response headers:
---
content-length: 2255
content-type: text/plain
date: Wed, 14 Jul 2010 21:08:01 GMT
server: zope.server.http (HTTP)
status: 404
x-lazr-oopsid: OOPS-1656X28
x-powered-by: Zope (www.zope.org), Python (www.python.org)
---
Response body:
---
Object: <canonical.
<BLANKLINE>
Traceback (most recent call last):
File "/home/
obj = request.
File "/home/
result = super(WebServic
File "/home/
ob = super(BrowserRe
File "/home/
ob = super(HTTPRequest, self).traverse(obj)
File "/home/
obj = publication.
File "/home/
request, ob, name)
File "/home/
ob2 = adapter.
File "/home/
return Navigation.
File "/home/
nextobj = self._publishTr
File "/home/
return self._handle_
File "/home/
raise NotFound(
NotFound: Object: <canonical.
<BLANKLINE>
---
<BLANKLINE>
and then finally this:
File "/home/ jw2328/ devel/launchpad lib/launchpadli b/launchpadlib/ src/launchpadli b/tests/ ../docs/ people. txt", line 34, in people.txt
Failed example:
me.name
Expected:
u'salgado'
Got:
'salgado'
which is what was failing when I tried to upgrade launchpad's copy.
This one is caused by the
332 representation = simplejson. loads(represent ation)
in lazr.restfulcli ent.resource. If we want unicode strings then pass unicode to
simplejson.
Thanks,
James