Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Commit

Permalink
use pytest instead of nose
Browse files Browse the repository at this point in the history
  • Loading branch information
Grigouze committed Mar 26, 2018
1 parent 90a0958 commit 94f0fd3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -11,6 +11,6 @@ install:
- 'pip install -e ".[test]"'
- 'pip install coveralls'
script:
- "python ./setup.py nosetests"
- "python ./setup.py test"
after_success:
- coveralls
28 changes: 26 additions & 2 deletions setup.py
Expand Up @@ -6,19 +6,43 @@
import sys

from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand

here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.md')).read()
CHANGES = open(os.path.join(here, 'CHANGES.rst')).read()


class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', "Arguments to pass into py.test")]

def initialize_options(self):
TestCommand.initialize_options(self)
try:
from multiprocessing import cpu_count
self.pytest_args = ['-n', str(cpu_count()), '--boxed']
self.pytest_args = []
except (ImportError, NotImplementedError):
self.pytest_args = ['-n', '1', '--boxed']

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

def run_tests(self):
import pytest

errno = pytest.main(self.pytest_args)
sys.exit(errno)

with open(os.path.join(here, 'gandi', 'cli', '__init__.py')) as v_file:
version = re.compile(r".*__version__ = '(.*?)'",
re.S).match(v_file.read()).group(1)

requires = ['setuptools', 'pyyaml', 'click>=3.1', 'requests', 'IPy']

tests_require = ['nose', 'coverage', 'tox']
tests_require = ['pytest', 'pytest-cov', 'tox']
if sys.version_info < (2, 7):
tests_require += ['unittest2', 'importlib']

Expand Down Expand Up @@ -51,11 +75,11 @@
],
url='https://github.com/Gandi/gandi.cli',
packages=find_packages(),
cmdclass={'test': PyTest},
include_package_data=True,
zip_safe=False,
install_requires=requires,
tests_require=tests_require,
test_suite='nose.collector',
extras_require=extras_require,
entry_points={
'console_scripts': [
Expand Down

0 comments on commit 94f0fd3

Please sign in to comment.