File tree Expand file tree Collapse file tree 1 file changed +36
-2
lines changed
Expand file tree Collapse file tree 1 file changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -611,6 +611,40 @@ def get_namespace_packages(self):
611611
612612class Tests (OptionalPackage ):
613613 name = "tests"
614+ nose_min_version = '0.11.1'
615+
616+ def check (self ):
617+ super (Tests , self ).check ()
618+
619+ msgs = []
620+ msg_template = ('{package} is required to run the matplotlib test '
621+ 'suite. pip/easy_install may attempt to install it '
622+ 'after matplotlib.' )
623+ )
624+
625+
626+ bad_nose = msg_template .format (
627+ package = 'nose %s or later' % self .nose_min_version
628+ try :
629+ import nose
630+ if is_min_version (nose .__version__ , self .nose_min_version ):
631+ msgs += ['using nose version %s' % nose .__version__ ]
632+ else :
633+ msgs += [bad_nose ]
634+ except ImportError :
635+ msgs + = [bad_nose ]
636+
637+
638+ if sys .version_info >= (3 , 3 ):
639+ msgs += ['using unittest.mock' ]
640+ else :
641+ try :
642+ import mock
643+ msgs += ['using mock %s' % mock .__version__ ]
644+ except ImportError :
645+ msgs += [msg_template .format (package = 'mock' )]
646+
647+ return ' / ' .join (msgs )
614648
615649 def get_packages (self ):
616650 return [
@@ -631,8 +665,8 @@ def get_package_data(self):
631665 ]}
632666
633667 def get_install_requires (self ):
634- requires = ['nose>=0.11.1' ]
635- if not sys .version_info > (3 , 3 ):
668+ requires = ['nose>=%s' % self . nose_min_version ]
669+ if not sys .version_info >= (3 , 3 ):
636670 requires += ['mock' ]
637671 return requires
638672
You can’t perform that action at this time.
0 commit comments