Use platform.python_version() to show Python version number

This results in something like "3.5.0b2" for non-final releases
while still being "3.5.0" for final releases.
This commit is contained in:
Floris Bruynooghe 2015-05-31 20:31:31 +01:00
parent b09be4e3ef
commit d220be8468
1 changed files with 2 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import pluggy
import py import py
import sys import sys
import time import time
import platform
def pytest_addoption(parser): def pytest_addoption(parser):
@ -274,7 +275,7 @@ class TerminalReporter:
if not self.showheader: if not self.showheader:
return return
self.write_sep("=", "test session starts", bold=True) self.write_sep("=", "test session starts", bold=True)
verinfo = ".".join(map(str, sys.version_info[:3])) verinfo = platform.python_version()
msg = "platform %s -- Python %s" % (sys.platform, verinfo) msg = "platform %s -- Python %s" % (sys.platform, verinfo)
if hasattr(sys, 'pypy_version_info'): if hasattr(sys, 'pypy_version_info'):
verinfo = ".".join(map(str, sys.pypy_version_info[:3])) verinfo = ".".join(map(str, sys.pypy_version_info[:3]))