132
132
]
133
133
134
134
135
- class NoseTestCommand (TestCommand ):
136
- """Invoke unit tests using nose after an in-place build."""
137
-
138
- description = "Invoke unit tests using nose after an in-place build."
139
- user_options = [
140
- ("pep8-only" , None , "pep8 checks" ),
141
- ("omit-pep8" , None , "Do not perform pep8 checks" ),
142
- ("nocapture" , None , "do not capture stdout (nosetests)" ),
143
- ("nose-verbose" , None , "be verbose (nosetests)" ),
144
- ("processes=" , None , "number of processes (nosetests)" ),
145
- ("process-timeout=" , None , "process timeout (nosetests)" ),
146
- ("with-coverage" , None , "with coverage" ),
147
- ("detailed-error-msg" , None , "detailed error message (nosetest)" ),
148
- ("tests=" , None , "comma separated selection of tests (nosetest)" ),
149
- ]
150
-
151
- def initialize_options (self ):
152
- self .pep8_only = None
153
- self .omit_pep8 = None
154
-
155
- # parameters passed to nose tests
156
- self .processes = None
157
- self .process_timeout = None
158
- self .nose_verbose = None
159
- self .nocapture = None
160
- self .with_coverage = None
161
- self .detailed_error_msg = None
162
- self .tests = None
163
-
164
- def finalize_options (self ):
165
- self .test_args = []
166
- if self .pep8_only :
167
- self .pep8_only = True
168
- if self .omit_pep8 :
169
- self .omit_pep8 = True
170
-
171
- if self .pep8_only and self .omit_pep8 :
172
- from distutils .errors import DistutilsOptionError
173
- raise DistutilsOptionError (
174
- "You are using several options for the test command in an "
175
- "incompatible manner. Please use either --pep8-only or "
176
- "--omit-pep8"
177
- )
178
-
179
- if self .processes :
180
- self .test_args .append ("--processes={prc}" .format (
181
- prc = self .processes ))
182
-
183
- if self .process_timeout :
184
- self .test_args .append ("--process-timeout={tout}" .format (
185
- tout = self .process_timeout ))
186
-
187
- if self .nose_verbose :
188
- self .test_args .append ("--verbose" )
189
-
190
- if self .nocapture :
191
- self .test_args .append ("--nocapture" )
192
-
193
- if self .with_coverage :
194
- self .test_args .append ("--with-coverage" )
195
-
196
- if self .detailed_error_msg :
197
- self .test_args .append ("-d" )
198
-
199
- if self .tests :
200
- self .test_args .append ("--tests={names}" .format (names = self .tests ))
201
-
135
+ class NoopTestCommand (TestCommand ):
202
136
def run (self ):
203
- if self .distribution .install_requires :
204
- self .distribution .fetch_build_eggs (
205
- self .distribution .install_requires )
206
- if self .distribution .tests_require :
207
- self .distribution .fetch_build_eggs (self .distribution .tests_require )
208
-
209
- self .announce ('running unittests with nose' )
210
- self .with_project_on_sys_path (self .run_tests )
211
-
212
- def run_tests (self ):
213
- import matplotlib
214
- matplotlib .use ('agg' )
215
- import nose
216
- from matplotlib .testing .noseclasses import KnownFailure
217
- from matplotlib import default_test_modules as testmodules
218
- from matplotlib import font_manager
219
- import time
220
- # Make sure the font caches are created before starting any possibly
221
- # parallel tests
222
- if font_manager ._fmcache is not None :
223
- while not os .path .exists (font_manager ._fmcache ):
224
- time .sleep (0.5 )
225
- plugins = [KnownFailure ]
226
-
227
- # Nose doesn't automatically instantiate all of the plugins in the
228
- # child processes, so we have to provide the multiprocess plugin
229
- # with a list.
230
- from nose .plugins import multiprocess
231
- multiprocess ._instantiate_plugins = plugins
232
-
233
- if self .omit_pep8 :
234
- testmodules .remove ('matplotlib.tests.test_coding_standards' )
235
- elif self .pep8_only :
236
- testmodules = ['matplotlib.tests.test_coding_standards' ]
237
-
238
- nose .main (addplugins = [x () for x in plugins ],
239
- defaultTest = testmodules ,
240
- argv = ['nosetests' ] + self .test_args ,
241
- exit = True )
242
-
137
+ print ("Matplotlib does not support running tests with "
138
+ "'python setup.py test'. Please run 'python tests.py'" )
243
139
244
140
class BuildExtraLibraries (BuildExtCommand ):
245
141
def run (self ):
@@ -250,7 +146,7 @@ def run(self):
250
146
251
147
252
148
cmdclass = versioneer .get_cmdclass ()
253
- cmdclass ['test' ] = NoseTestCommand
149
+ cmdclass ['test' ] = NoopTestCommand
254
150
cmdclass ['build_ext' ] = BuildExtraLibraries
255
151
256
152
# patch bdist_wheel for a bug on windows
@@ -280,7 +176,6 @@ def run(self):
280
176
package_dir = {'' : 'lib' }
281
177
install_requires = []
282
178
setup_requires = []
283
- tests_require = []
284
179
default_backend = None
285
180
286
181
# Go through all of the packages and figure out which ones we are
@@ -339,7 +234,6 @@ def run(self):
339
234
package_data [key ] = list (set (val + package_data [key ]))
340
235
install_requires .extend (package .get_install_requires ())
341
236
setup_requires .extend (package .get_setup_requires ())
342
- tests_require .extend (package .get_tests_require ())
343
237
344
238
# Write the default matplotlibrc file
345
239
if default_backend is None :
@@ -399,7 +293,6 @@ def run(self):
399
293
# List third-party Python packages that we require
400
294
install_requires = install_requires ,
401
295
setup_requires = setup_requires ,
402
- tests_require = tests_require ,
403
296
404
297
# matplotlib has C/C++ extensions, so it's not zip safe.
405
298
# Telling setuptools this prevents it from doing an automatic
0 commit comments