Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
23 changes: 18 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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,
Expand Down
22 changes: 14 additions & 8 deletions setupext.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down