Skip to content

Commit

Permalink
Fix setup.py test for setuptools 18.4
Browse files Browse the repository at this point in the history
TestCommand.test_args becomes unsettable property for Py3, and
test_suite must be a string. Try to write it so that it works for old
and new setuptools.
  • Loading branch information
pv committed Oct 18, 2015
1 parent f85e7d2 commit d8da465
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,23 @@ def initialize_options(self):

def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = ['test']
self.test_suite = True

# The following is required for setuptools<18.4
try:
self.test_args = []
except AttributeError:
# fails on setuptools>=18.4
pass
self.test_suite = 'unused'

def run_tests(self):
import pytest
test_args = ['test']
if self.pytest_args:
self.test_args += self.pytest_args.split()
test_args += self.pytest_args.split()
if self.coverage:
self.test_args += ['--cov', 'asv']
errno = pytest.main(self.test_args)
test_args += ['--cov', 'asv']
errno = pytest.main(test_args)
sys.exit(errno)


Expand Down

0 comments on commit d8da465

Please sign in to comment.