diff --git a/setup.py b/setup.py index 95e05a67d258..cd0eb52e47d9 100644 --- a/setup.py +++ b/setup.py @@ -132,10 +132,23 @@ ] -class NoopTestCommand(TestCommand): - def run(self): - print("Matplotlib does not support running tests with " - "'python setup.py test'. Please run 'python tests.py'") +class PyTestCommand(TestCommand): + user_options = [ + ("pytest-args=", "a", "Arguments to pass to pytest"), + ("local-freetype", None, "setup.cfg back-compatibility; do not use")] + + def initialize_options(self): + TestCommand.initialize_options(self) + self.pytest_args = "" + self.local_freetype = "" + + install_dists = staticmethod(lambda dist: []) + + def run_tests(self): + import shlex + import pytest + errno = pytest.main(shlex.split(self.pytest_args)) + sys.exit(errno) class BuildExtraLibraries(BuildExtCommand): @@ -147,7 +160,7 @@ def run(self): cmdclass = versioneer.get_cmdclass() -cmdclass['test'] = NoopTestCommand +cmdclass['test'] = PyTestCommand cmdclass['build_ext'] = BuildExtraLibraries # One doesn't normally see `if __name__ == '__main__'` blocks in a setup.py, diff --git a/setupext.py b/setupext.py index 1b03b4d93bf2..5c893a805904 100644 --- a/setupext.py +++ b/setupext.py @@ -100,19 +100,25 @@ def _get_xdg_cache_dir(): config = configparser.SafeConfigParser() config.read(setup_cfg) - if config.has_option('status', 'suppress'): + try: options['display_status'] = not config.getboolean("status", "suppress") - - if config.has_option('rc_options', 'backend'): + except configparser.Error: + pass + try: options['backend'] = config.get("rc_options", "backend") - - if config.has_option('directories', 'basedirlist'): + except configparser.Error: + pass + try: options['basedirlist'] = [ x.strip() for x in config.get("directories", "basedirlist").split(',')] - - if config.has_option('test', 'local_freetype'): - options['local_freetype'] = config.getboolean("test", "local_freetype") + except configparser.Error: + pass + try: + options['local_freetype'] = config.getboolean( + "test_build", "local_freetype") + except configparser.Error: + pass else: config = None pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy