summaryrefslogtreecommitdiffstats
path: root/Lib/unittest
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2014-07-22 12:00:37 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2014-07-22 12:00:37 (GMT)
commit521e5860a5c121700e6ccc5f07053d21b83652df (patch)
tree242d90c511e3fbe9f2c09073429351ab02bd7693 /Lib/unittest
parentc09e9752c689338efff252408f38a77683a12cb4 (diff)
downloadcpython-521e5860a5c121700e6ccc5f07053d21b83652df.zip
cpython-521e5860a5c121700e6ccc5f07053d21b83652df.tar.gz
cpython-521e5860a5c121700e6ccc5f07053d21b83652df.tar.bz2
Issue #22032: __qualname__ instead of __name__ is now always used to format
fully qualified class names of Python implemented classes.
Diffstat (limited to 'Lib/unittest')
-rw-r--r--Lib/unittest/test/test_setups.py7
-rw-r--r--Lib/unittest/util.py2
2 files changed, 5 insertions, 4 deletions
diff --git a/Lib/unittest/test/test_setups.py b/Lib/unittest/test/test_setups.py
index 392f95e..2df703e 100644
--- a/Lib/unittest/test/test_setups.py
+++ b/Lib/unittest/test/test_setups.py
@@ -111,7 +111,7 @@ class TestSetups(unittest.TestCase):
self.assertEqual(len(result.errors), 1)
error, _ = result.errors[0]
self.assertEqual(str(error),
- 'setUpClass (%s.BrokenTest)' % __name__)
+ 'setUpClass (%s.%s)' % (__name__, BrokenTest.__qualname__))
def test_error_in_teardown_class(self):
class Test(unittest.TestCase):
@@ -144,7 +144,7 @@ class TestSetups(unittest.TestCase):
error, _ = result.errors[0]
self.assertEqual(str(error),
- 'tearDownClass (%s.Test)' % __name__)
+ 'tearDownClass (%s.%s)' % (__name__, Test.__qualname__))
def test_class_not_torndown_when_setup_fails(self):
class Test(unittest.TestCase):
@@ -414,7 +414,8 @@ class TestSetups(unittest.TestCase):
self.assertEqual(len(result.errors), 0)
self.assertEqual(len(result.skipped), 1)
skipped = result.skipped[0][0]
- self.assertEqual(str(skipped), 'setUpClass (%s.Test)' % __name__)
+ self.assertEqual(str(skipped),
+ 'setUpClass (%s.%s)' % (__name__, Test.__qualname__))
def test_skiptest_in_setupmodule(self):
class Test(unittest.TestCase):
diff --git a/Lib/unittest/util.py b/Lib/unittest/util.py
index aee498f..45485dc 100644
--- a/Lib/unittest/util.py
+++ b/Lib/unittest/util.py
@@ -52,7 +52,7 @@ def safe_repr(obj, short=False):
return result[:_MAX_LENGTH] + ' [truncated]...'
def strclass(cls):
- return "%s.%s" % (cls.__module__, cls.__name__)
+ return "%s.%s" % (cls.__module__, cls.__qualname__)
def sorted_list_difference(expected, actual):
"""Finds elements in only one or the other of two, sorted input lists.