Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1c5c21c

Browse files
committed
Change setup.py test to a noop telling users to run tests.py
1 parent 7820787 commit 1c5c21c

File tree

1 file changed

+4
-111
lines changed

1 file changed

+4
-111
lines changed

setup.py

Lines changed: 4 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -132,114 +132,10 @@
132132
]
133133

134134

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):
202136
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'")
243139

244140
class BuildExtraLibraries(BuildExtCommand):
245141
def run(self):
@@ -250,7 +146,7 @@ def run(self):
250146

251147

252148
cmdclass = versioneer.get_cmdclass()
253-
cmdclass['test'] = NoseTestCommand
149+
cmdclass['test'] = NoopTestCommand
254150
cmdclass['build_ext'] = BuildExtraLibraries
255151

256152

@@ -268,7 +164,6 @@ def run(self):
268164
package_dir = {'': 'lib'}
269165
install_requires = []
270166
setup_requires = []
271-
tests_require = []
272167
default_backend = None
273168

274169
# Go through all of the packages and figure out which ones we are
@@ -327,7 +222,6 @@ def run(self):
327222
package_data[key] = list(set(val + package_data[key]))
328223
install_requires.extend(package.get_install_requires())
329224
setup_requires.extend(package.get_setup_requires())
330-
tests_require.extend(package.get_tests_require())
331225

332226
# Write the default matplotlibrc file
333227
if default_backend is None:
@@ -387,7 +281,6 @@ def run(self):
387281
# List third-party Python packages that we require
388282
install_requires=install_requires,
389283
setup_requires=setup_requires,
390-
tests_require=tests_require,
391284

392285
# matplotlib has C/C++ extensions, so it's not zip safe.
393286
# Telling setuptools this prevents it from doing an automatic

0 commit comments

Comments
 (0)