This is an archive of the discontinued LLVM Phabricator instance.

[LNT] Python 3 support: print unknown metric with str
ClosedPublic

Authored by thopre on Oct 10 2019, 8:44 AM.

Details

Summary

When encountering an unknown metric, LNT throws a ValueError with a
message indicating the problem. That message uses %r and thus __repr__
to print the metric name which leads to difference between Python 2 and
Python 3 since the former prefix unicode string with a 'u' but the
latter do not. This leads to a failure of server/db/yamlschema.shtest.

This commit uses %s and thus __str__ to get a consistent display and
adapt the test accordingly.