aboutsummaryrefslogtreecommitdiff
path: root/python/ovs/json.py
AgeCommit message (Collapse)Author
2011-07-06python: Make invalid UTF-8 sequence messages consistent across Python versions.Ben Pfaff
Given the invalid input <C0 22>, some versions of Python report <C0> as the invalid sequence and other versions report <C0 22> as the invalid sequence. Similarly, given input <ED 80 7F>, some report <ED 80> and others report <ED 80 7F> as the invalid sequence. This caused spurious test failures for the test "no invalid UTF-8 sequences in strings - Python", so this commit makes the messages consistent by dropping the extra trailing byte from the message. I first noticed the longer sequences <C0 22> and <ED 80 7F> on Ubuntu 10.04 with python version 2.6.5-0ubuntu1, but undoubtedly it exists elsewhere also.
2011-05-24tests: Fix the two Python XFAIL tests.Ben Pfaff
OVS has two Python tests that have always failed, for reasons not understood, since they were added to the tree. This commit fixes them. One problem was that Python was assuming that stdout was encoded in ASCII. Apparently the only way to "fix" this at runtime is to set PYTHONIOENCODING to utf_8 in the environment, so this change does that. Second, it appears that Python really doesn't like to print invalid UTF-8, so this avoids doing that in python/ovs/json.py, instead just printing the hexadecimal values of the invalid bytes. For consistency, it makes the same change to the C version. Third, the C version of test-ovsdb doesn't check UTF-8 for consistency, it just sends it blindly to the OVSDB server, but Python does check it and so it bails out earlier. This commit changes the Python version of the "no invalid UTF-8 sequences in strings" to allow for the slight difference in output that occurs for that reason. Finally, test-ovsdb.py needs to convert error messages to Unicode explicitly before printing them in the "parse-atoms" function. I don't really understand why, but now it works.
2010-08-25Implement initial Python bindings for Open vSwitch database.Ben Pfaff
These initial bindings pass a few hundred of the corresponding tests for C implementations of various bits of the Open vSwitch library API. The poorest part of them is actually the Python IDL interface in ovs.db.idl, which has not received enough attention yet. It appears to work, but it doesn't yet support writes (transactions) and it is difficult to use. I hope to improve it as it becomes clear what semantics Python applications actually want from an IDL.