Merge lp:~jkakar/txfluiddb/failing-tests into lp:txfluiddb
Proposed by
Jamu Kakar
Status: | Merged |
---|---|
Approved by: | Tristan Seligmann |
Approved revision: | 11 |
Merged at revision: | 10 |
Proposed branch: | lp:~jkakar/txfluiddb/failing-tests |
Merge into: | lp:txfluiddb |
Diff against target: |
130 lines (+72/-5) 2 files modified
txfluiddb/client.py (+21/-4) txfluiddb/test/test_client.py (+51/-1) |
To merge this branch: | bzr merge lp:~jkakar/txfluiddb/failing-tests |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tristan Seligmann | Approve | ||
Review via email: mp+27431@code.launchpad.net |
Description of the change
This branch introduces the following changes:
- Uses the 'json' package, if available, otherwise falls back to
'simplejson'. I *think* this will solve the issues, but I've only
tested on Ubuntu 10.04 with Python 2.6.5.
- Adds a test using a unicode value, to make sure encoding/decoding
works as expected.
To post a comment you must log in.
Using simplejson (on Python 2.5.5), it still fails like so:
======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= == test.test_ client. ObjectTests. test_getString
[FAIL]: txfluiddb.
Traceback (most recent call last): mithrandi/ code/txFluidDB/ trunk/txfluiddb /test/test_ client. py", line 680, in _gotResponse assertIsInstanc e(response, unicode) mithrandi/ code/Twisted/ trunk/twisted/ trial/unittest. py", line 504, in failUnlessIsIns tance trial.unittest. FailTest: 'Data goes where?' is not an instance of <type 'unicode'> ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= == test.test_ client. NamespaceTests. test_getNamespa ces
File "/home/
self.
File "/home/
self.fail("%r is not an instance of %s" % (instance, classOrTuple))
twisted.
=======
[ERROR]: txfluiddb.
Traceback (most recent call last): mithrandi/ code/txFluidDB/ trunk/txfluiddb /client. py", line 230, in _parseResponse append( self.child( name)) mithrandi/ code/txFluidDB/ trunk/txfluiddb /client. py", line 152, in child mithrandi/ code/txFluidDB/ trunk/txfluiddb /client. py", line 47, in __init__ checkComponent( component) mithrandi/ code/txFluidDB/ trunk/txfluiddb /client. py", line 60, in checkComponent errors. InvalidName: Name of type <type 'str'> is not unicode: 'ns1' ======= ======= ======= ======= ======= ======= ======= ======= ======= ======= == test.test_ client. NamespaceTests. test_getTags
File "/home/
namespaces.
File "/home/
return type(self)(*path)
File "/home/
self.
File "/home/
'Name of type %r is not unicode: %r' % (type(name), name))
txfluiddb.
=======
[ERROR]: txfluiddb.
Traceback (most recent call last): mithrandi/ code/txFluidDB/ trunk/txfluiddb /client. py", line 251, in _parseResponse append( self.tag( name)) mithrandi/ code/txFluidDB/ trunk/txfluiddb /client. py", line 167, in tag mithrandi/ code/txFluidDB/ trunk/txfluiddb /client. py", line 47, in __init__ checkComponent( component) mithrandi/ code/txFluidDB/ trunk/txfluiddb /client. py", line 60, in checkComponent errors. InvalidName: Name of type <type 'str'> is not unicode: 'tag1' ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- --
File "/home/
tags.
File "/home/
return Tag(*path)
File "/home/
self.
File "/home/
'Name of type %r is not unicode: %r' % (type(name), name))
txfluiddb.
-------
I think this is really just an issue with the use of json.dumps in the tests; when it gives us back a str, when we pass that to json.loads again, it'll also give us strs. Introducing a utility function that decodes the result of json.dumps if it is str should be sufficient to deal with the problem, I hope.