def check(self):
try:
import dateutil
except ImportError:
# dateutil 2.1 has a file encoding bug that breaks installation on
# python 3.3
# https://github.com/matplotlib/matplotlib/issues/2373
# hack around the problem by installing the (working) v2.0
#major, minor1, _, _, _ = sys.version_info
#if self.version is None and (major, minor1) == (3, 3):
#self.version = '!=2.1'
raise CheckFailed (
"could not be found")
major, minor1, _, _, _ = sys.version_info
if dateutil.__version__ == '2.1' and (major, minor1) == (3, 3):
raise CheckFailed (
"dateutil v. 2.1 has a bug that breaks installation"
"on python 3.3.x, use another dateutil version")
return "using dateutil version %s" % dateutil.__version__
python类__version__()的实例源码
def check(self):
try:
import pyparsing
except ImportError:
raise CheckFailed(
"could not be found")
required = [1, 5, 6]
if [int(x) for x in pyparsing.__version__.split('.')] < required:
raise CheckFailed(
"matplotlib requires pyparsing >= {0}".format(
'.'.join(str(x) for x in required)))
if not self.is_ok():
return (
"Your pyparsing contains a bug that will be monkey-patched by "
"matplotlib. For best results, upgrade to pyparsing 2.0.1 or "
"later.")
return "using pyparsing version %s" % pyparsing.__version__
def testVersion(self):
# Ensuring the correct version of pytz has been loaded
self.assertEqual(EXPECTED_VERSION, pytz.__version__,
'Incorrect pytz version loaded. Import path is stuffed '
'or this test needs updating. (Wanted %s, got %s)'
% (EXPECTED_VERSION, pytz.__version__)
)
def testVersion(self):
# Ensuring the correct version of pytz has been loaded
self.assertEqual(EXPECTED_VERSION, pytz.__version__,
'Incorrect pytz version loaded. Import path is stuffed '
'or this test needs updating. (Wanted %s, got %s)'
% (EXPECTED_VERSION, pytz.__version__))
self.assertEqual(EXPECTED_OLSON_VERSION, pytz.OLSON_VERSION,
'Incorrect pytz version loaded. Import path is stuffed '
'or this test needs updating. (Wanted %s, got %s)'
% (EXPECTED_OLSON_VERSION, pytz.OLSON_VERSION))
def check(self):
super(Tests, self).check()
msgs = []
msg_template = ('{package} is required to run the matplotlib test '
'suite. Please install it with pip or your preferred'
' tool to run the test suite')
bad_nose = msg_template.format(
package='nose %s or later' % self.nose_min_version
)
try:
import nose
if is_min_version(nose.__version__, self.nose_min_version):
msgs += ['using nose version %s' % nose.__version__]
else:
msgs += [bad_nose]
except ImportError:
msgs += [bad_nose]
if sys.version_info >= (3, 3):
msgs += ['using unittest.mock']
else:
try:
import mock
msgs += ['using mock %s' % mock.__version__]
except ImportError:
msgs += [msg_template.format(package='mock')]
return ' / '.join(msgs)
def check(self):
min_version = extract_versions()['__version__numpy__']
try:
import numpy
except ImportError:
raise CheckFailed(
"could not be found" )
if not is_min_version(numpy.__version__, min_version):
raise CheckFailed(
"requires numpy %s or later to build. (Found %s)" %
(min_version, numpy.__version__))
return 'version %s' % numpy.__version__
def check(self):
try:
import six
except ImportError:
raise CheckFailed("six was not found.")
if not is_min_version(six.__version__, self.min_version):
return ("The installed version of six is {inst_ver} but "
"a the minimum required version is {min_ver}. "
"pip/easy install will attempt to install a "
"newer version."
).format(min_ver=self.min_version,
inst_ver=six.__version__)
return "using six version %s" % six.__version__
def testVersion(self):
# Ensuring the correct version of pytz has been loaded
self.assertEqual(EXPECTED_VERSION, pytz.__version__,
'Incorrect pytz version loaded. Import path is stuffed '
'or this test needs updating. (Wanted %s, got %s)'
% (EXPECTED_VERSION, pytz.__version__)
)
def testVersion(self):
# Ensuring the correct version of pytz has been loaded
self.assertEqual(EXPECTED_VERSION, pytz.__version__,
'Incorrect pytz version loaded. Import path is stuffed '
'or this test needs updating. (Wanted %s, got %s)'
% (EXPECTED_VERSION, pytz.__version__)
)
def testVersion(self):
# Ensuring the correct version of pytz has been loaded
self.assertEqual(EXPECTED_VERSION, pytz.__version__,
'Incorrect pytz version loaded. Import path is stuffed '
'or this test needs updating. (Wanted %s, got %s)'
% (EXPECTED_VERSION, pytz.__version__))
self.assertEqual(EXPECTED_OLSON_VERSION, pytz.OLSON_VERSION,
'Incorrect pytz version loaded. Import path is stuffed '
'or this test needs updating. (Wanted %s, got %s)'
% (EXPECTED_OLSON_VERSION, pytz.OLSON_VERSION))
def testVersion(self):
# Ensuring the correct version of pytz has been loaded
self.assertEqual(EXPECTED_VERSION, pytz.__version__,
'Incorrect pytz version loaded. Import path is stuffed '
'or this test needs updating. (Wanted %s, got %s)'
% (EXPECTED_VERSION, pytz.__version__))
self.assertEqual(EXPECTED_OLSON_VERSION, pytz.OLSON_VERSION,
'Incorrect pytz version loaded. Import path is stuffed '
'or this test needs updating. (Wanted %s, got %s)'
% (EXPECTED_OLSON_VERSION, pytz.OLSON_VERSION))
def testVersion(self):
# Ensuring the correct version of pytz has been loaded
self.assertEqual(EXPECTED_VERSION, pytz.__version__,
'Incorrect pytz version loaded. Import path is stuffed '
'or this test needs updating. (Wanted %s, got %s)'
% (EXPECTED_VERSION, pytz.__version__))
self.assertEqual(EXPECTED_OLSON_VERSION, pytz.OLSON_VERSION,
'Incorrect pytz version loaded. Import path is stuffed '
'or this test needs updating. (Wanted %s, got %s)'
% (EXPECTED_OLSON_VERSION, pytz.OLSON_VERSION))