127127 ]
128128
129129
130- class NoseTestCommand (TestCommand ):
131- """Invoke unit tests using nose after an in-place build."""
132-
133- description = "Invoke unit tests using nose after an in-place build."
134- user_options = [
135- ("pep8-only" , None , "pep8 checks" ),
136- ("omit-pep8" , None , "Do not perform pep8 checks" ),
137- ("nocapture" , None , "do not capture stdout (nosetests)" ),
138- ("nose-verbose" , None , "be verbose (nosetests)" ),
139- ("processes=" , None , "number of processes (nosetests)" ),
140- ("process-timeout=" , None , "process timeout (nosetests)" ),
141- ("with-coverage" , None , "with coverage" ),
142- ("detailed-error-msg" , None , "detailed error message (nosetest)" ),
143- ("tests=" , None , "comma separated selection of tests (nosetest)" ),
144- ]
145-
146- def initialize_options (self ):
147- self .pep8_only = None
148- self .omit_pep8 = None
149-
150- # parameters passed to nose tests
151- self .processes = None
152- self .process_timeout = None
153- self .nose_verbose = None
154- self .nocapture = None
155- self .with_coverage = None
156- self .detailed_error_msg = None
157- self .tests = None
158-
159- def finalize_options (self ):
160- self .test_args = []
161- if self .pep8_only :
162- self .pep8_only = True
163- if self .omit_pep8 :
164- self .omit_pep8 = True
165-
166- if self .pep8_only and self .omit_pep8 :
167- from distutils .errors import DistutilsOptionError
168- raise DistutilsOptionError (
169- "You are using several options for the test command in an "
170- "incompatible manner. Please use either --pep8-only or "
171- "--omit-pep8"
172- )
173-
174- if self .processes :
175- self .test_args .append ("--processes={prc}" .format (
176- prc = self .processes ))
177-
178- if self .process_timeout :
179- self .test_args .append ("--process-timeout={tout}" .format (
180- tout = self .process_timeout ))
181-
182- if self .nose_verbose :
183- self .test_args .append ("--verbose" )
184-
185- if self .nocapture :
186- self .test_args .append ("--nocapture" )
187-
188- if self .with_coverage :
189- self .test_args .append ("--with-coverage" )
190-
191- if self .detailed_error_msg :
192- self .test_args .append ("-d" )
193-
194- if self .tests :
195- self .test_args .append ("--tests={names}" .format (names = self .tests ))
196-
130+ class NoopTestCommand (TestCommand ):
197131 def run (self ):
198- if self .distribution .install_requires :
199- self .distribution .fetch_build_eggs (
200- self .distribution .install_requires )
201- if self .distribution .tests_require :
202- self .distribution .fetch_build_eggs (self .distribution .tests_require )
203-
204- self .announce ('running unittests with nose' )
205- self .with_project_on_sys_path (self .run_tests )
206-
207- def run_tests (self ):
208- import matplotlib
209- matplotlib .use ('agg' )
210- import nose
211- from matplotlib .testing .noseclasses import KnownFailure
212- from matplotlib import default_test_modules as testmodules
213- from matplotlib import font_manager
214- import time
215- # Make sure the font caches are created before starting any possibly
216- # parallel tests
217- if font_manager ._fmcache is not None :
218- while not os .path .exists (font_manager ._fmcache ):
219- time .sleep (0.5 )
220- plugins = [KnownFailure ]
221-
222- # Nose doesn't automatically instantiate all of the plugins in the
223- # child processes, so we have to provide the multiprocess plugin
224- # with a list.
225- from nose .plugins import multiprocess
226- multiprocess ._instantiate_plugins = plugins
227-
228- if self .omit_pep8 :
229- testmodules .remove ('matplotlib.tests.test_coding_standards' )
230- elif self .pep8_only :
231- testmodules = ['matplotlib.tests.test_coding_standards' ]
232-
233- nose .main (addplugins = [x () for x in plugins ],
234- defaultTest = testmodules ,
235- argv = ['nosetests' ] + self .test_args ,
236- exit = True )
132+ print ("Matplotlib does not support running tests with "
133+ "'python setup.py test'. Please run 'python tests.py'" )
237134
238135cmdclass = versioneer .get_cmdclass ()
239- cmdclass ['test' ] = NoseTestCommand
136+ cmdclass ['test' ] = NoopTestCommand
240137
241138# One doesn't normally see `if __name__ == '__main__'` blocks in a setup.py,
242139# however, this is needed on Windows to avoid creating infinite subprocesses
@@ -252,7 +149,6 @@ def run_tests(self):
252149 package_dir = {'' : 'lib' }
253150 install_requires = []
254151 setup_requires = []
255- tests_require = []
256152 default_backend = None
257153
258154 # Go through all of the packages and figure out which ones we are
@@ -313,7 +209,6 @@ def run_tests(self):
313209 package_data [key ] = list (set (val + package_data [key ]))
314210 install_requires .extend (package .get_install_requires ())
315211 setup_requires .extend (package .get_setup_requires ())
316- tests_require .extend (package .get_tests_require ())
317212
318213 # Write the default matplotlibrc file
319214 if default_backend is None :
@@ -373,7 +268,6 @@ def run_tests(self):
373268 # List third-party Python packages that we require
374269 install_requires = install_requires ,
375270 setup_requires = setup_requires ,
376- tests_require = tests_require ,
377271
378272 # matplotlib has C/C++ extensions, so it's not zip safe.
379273 # Telling setuptools this prevents it from doing an automatic
0 commit comments