Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a13ed8d

Browse files
committed
tests display the Python implementation name
1 parent 8f14a0a commit a13ed8d

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

tests/test_pythoncapi_compat.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,18 @@ def test_func():
112112
ver = sys.version_info
113113
build = 'debug' if hasattr(sys, 'gettotalrefcount') else 'release'
114114
msg = "%s tests succeeded!" % len(tests)
115-
msg = "Python %s.%s (%s build): %s" % (ver.major, ver.minor, build, msg)
115+
if hasattr(sys, 'implementation'):
116+
python_impl = sys.implementation.name
117+
if python_impl == 'cpython':
118+
python_impl = 'CPython'
119+
elif python_impl == 'pypy':
120+
python_impl = 'PyPy'
121+
else:
122+
if "PyPy" in sys.version:
123+
python_impl = "PyPy"
124+
else:
125+
python_impl = 'Python'
126+
msg = "%s %s.%s (%s build): %s" % (python_impl, ver.major, ver.minor, build, msg)
116127
if check_refleak:
117128
msg = "%s (no reference leak detected)" % msg
118129
print(msg)

0 commit comments

Comments
 (0)