diff --git a/Cython/Tests/xmlrunner.py b/Cython/Tests/xmlrunner.py
index 4c9fb171fc400565d27a31edecfdca9e1a3a47b7..8e52f04bf0eef4ef75b8fc7358e9e3a5b0e86b12 100644
--- a/Cython/Tests/xmlrunner.py
+++ b/Cython/Tests/xmlrunner.py
@@ -213,7 +213,7 @@ class _XMLTestResult(_TextTestResult):
         for tests in (self.successes, self.failures, self.errors):
             for test_info in tests:
                 if not isinstance(test_info, _TestInfo):
-                    print("Unexpected test result type: %s" % test_info)
+                    print("Unexpected test result type: %r" % (test_info,))
                     continue
                 testcase = type(test_info.test_method)