May provide strings as attributes rather than unicode

Bug #605635 reported by James Westby
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lazr.restfulclient
Triaged
Low
Unassigned

Bug Description

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.

The failure I got, which was the same as when trying to land the upgrade was:

File "/home/jw2328/devel/launchpadlib/launchpadlib/launchpadlib/src/launchpadlib/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(representation)

in lazr.restfulclient.resource. If we want unicode strings then pass unicode to
simplejson.

Thanks,

James

James Westby (james-w)
description: updated
James Westby (james-w)
description: updated
Revision history for this message
James Westby (james-w) wrote :

Ah, I get it now, these doctests aren't supposed to be run outside of the Launchpad test suite.

Still, there are a couple of real bugs here, one of which is caught by the lazr.restfulclient
testsuite, but it seems that if run with an older simplejson or something it doesn't trigger
the problem. The other can be caught with a test there too.

Thanks,

James

description: updated
summary: - Test failures in trunk
+ May provide strings as attributes rather than unicode
affects: launchpadlib → lazr.restfulclient
James Westby (james-w)
description: updated
Revision history for this message
Gary Poster (gary) wrote :

> these doctests aren't supposed to be run outside of the Launchpad test suite.

Right.

> it seems that if run with an older simplejson or something it doesn't trigger the problem.

We've had very similar simplejson/unicode related problems in the past. I think the newer ones work better but there's also some odd edgecase that Benji encountered in which he simply rebuilt simplejson (with the same version as before) to correct a test failure like this.

I'm triaging low because we do run the tests in Launchpad's test suite, and they are passing. Counterarguments welcome.

Changed in lazr.restfulclient:
status: New → Triaged
importance: Undecided → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.