8000 setup.py test as test entry point. by anntzer · Pull Request #8135 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

setup.py test as test entry point. #8135

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

Closed
wants to merge 2 commits into from
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
0