8000 Remove setup.py tests and adapt docs to use tests.py by jenshnielsen · Pull Request #5434 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Remove setup.py tests and adapt docs to use tests.py #5434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 15, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change setup.py test to a noop telling users to run tests.py
  • Loading branch information
jenshnielsen committed Nov 24, 2015
commit 1c5c21c9e7e3d20419971aaa1dbb1afada9fdcb3
115 changes: 4 additions & 111 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,114 +132,10 @@
]


class NoseTestCommand(TestCommand):
"""Invoke unit tests using nose after an in-place build."""

description = "Invoke unit tests using nose after an in-place build."
user_options = [
("pep8-only", None, "pep8 checks"),
("omit-pep8", None, "Do not perform pep8 checks"),
("nocapture", None, "do not capture stdout (nosetests)"),
("nose-verbose", None, "be verbose (nosetests)"),
("processes=", None, "number of processes (nosetests)"),
("process-timeout=", None, "process timeout (nosetests)"),
("with-coverage", None, "with coverage"),
("detailed-error-msg", None, "detailed error message (nosetest)"),
("tests=", None, "comma separated selection of tests (nosetest)"),
]

def initialize_options(self):
self.pep8_only = None
self.omit_pep8 = None

# parameters passed to nose tests
self.processes = None
self.process_timeout = None
self.nose_verbose = None
self.nocapture = None
self.with_coverage = None
self.detailed_error_msg = None
self.tests = None

def finalize_options(self):
self.test_args = []
if self.pep8_only:
self.pep8_only = True
if self.omit_pep8:
self.omit_pep8 = True

if self.pep8_only and self.omit_pep8:
from distutils.errors import DistutilsOptionError
raise DistutilsOptionError(
"You are using several options for the test command in an "
"incompatible manner. Please use either --pep8-only or "
"--omit-pep8"
)

if self.processes:
self.test_args.append("--processes={prc}".format(
prc=self.processes))

if self.process_timeout:
self.test_args.append("--process-timeout={tout}".format(
tout=self.process_timeout))

if self.nose_verbose:
self.test_args.append("--verbose")

if self.nocapture:
self.test_args.append("--nocapture")

if self.with_coverage:
self.test_args.append("--with-coverage")

if self.detailed_error_msg:
self.test_args.append("-d")

if self.tests:
self.test_args.append("--tests={names}".format(names=self.tests))

class NoopTestCommand(TestCommand):
def run(self):
if self.distribution.install_requires:
self.distribution.fetch_build_eggs(
self.distribution.install_requires)
if self.distribution.tests_require:
self.distribution.fetch_build_eggs(self.distribution.tests_require)

self.announce('running unittests with nose')
self.with_project_on_sys_path(self.run_tests)

def run_tests(self):
import matplotlib
matplotlib.use('agg')
import nose
from matplotlib.testing.noseclasses import KnownFailure
from matplotlib import default_test_modules as testmodules
from matplotlib import font_manager
import time
# Make sure the font caches are created before starting any possibly
# parallel tests
if font_manager._fmcache is not None:
while not os.path.exists(font_manager._fmcache):
time.sleep(0.5)
plugins = [KnownFailure]

# Nose doesn't automatically instantiate all of the plugins in the
# child processes, so we have to provide the multiprocess plugin
# with a list.
from nose.plugins import multiprocess
multiprocess._instantiate_plugins = plugins

if self.omit_pep8:
testmodules.remove('matplotlib.tests.test_coding_standards')
elif self.pep8_only:
testmodules = ['matplotlib.tests.test_coding_standards']

nose.main(addplugins=[x() for x in plugins],
defaultTest=testmodules,
argv=['nosetests'] + self.test_args,
exit=True)

print("Matplotlib does not support running tests with "
"'python setup.py test'. Please run 'python tests.py'")

class BuildExtraLibraries(BuildExtCommand):
def run(self):
Expand All @@ -250,7 +146,7 @@ def run(self):


cmdclass = versioneer.get_cmdclass()
cmdclass['test'] = NoseTestCommand
cmdclass['test'] = NoopTestCommand
cmdclass['build_ext'] = BuildExtraLibraries


Expand All @@ -268,7 +164,6 @@ def run(self):
package_dir = {'': 'lib'}
install_requires = []
setup_requires = []
tests_require = []
default_backend = None

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

# Write the default matplotlibrc file
if default_backend is None:
Expand Down Expand Up @@ -387,7 +281,6 @@ def run(self):
# List third-party Python packages that we require
install_requires=install_requires,
setup_requires=setup_requires,
tests_require=tests_require,

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