Fix the new API fields support on Python 3.

Review Request #9731 — Created March 4, 2018 and submitted — Latest diff uploaded

Information

Djblets
release-2.0.x
2ec7a6c...

Reviewers

The new API fields support wasn't really testing what we wanted to test
as far as string types go. It was testing specifically Unicode strings
vs. byte strings, which wasn't going to work on Python 3. It should have
been testing Unicode strings vs. native strings (which are the same
thing on Python 3, but not on 2.7).

This change fixes up the tests and also fixes up string normalization to
ensure that any byte strings are properly decoded to Unicode strings.

It also fixes some ImportError-related checks in the tests to properly
match error messages across Python 2.x and 3.x.

Relevant unit tests pass on Python 2.7, 3.4, 3.5, and 3.6.