mirror of
https://github.com/openvswitch/ovs
synced 2025-10-25 15:07:05 +00:00
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.