Skip to content
Snippets Groups Projects
Commit 16144b84 authored by ulif's avatar ulif
Browse files

Flatten test setup.

We can tell `setuptools` to use `pytest_runner` when setup.py is
invoked.
parent 9c8b035d
No related branches found
No related tags found
No related merge requests found
import os
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
tests_path = os.path.join(os.path.dirname(__file__), 'tests')
class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', "Arguments to pass to py.test"), ]
def initialize_options(self):
TestCommand.initialize_options(self)
self.pytest_args = []
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
# import here, cause outside the eggs aren't loaded
import pytest
errno = pytest.main(self.pytest_args)
sys.exit(errno) # pragma: no cover
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup_requires = [
'pytest_runner',
]
install_requires = [
'setuptools',
]
......@@ -80,13 +61,13 @@ setup(
],
include_package_data=True,
zip_safe=False,
setup_requires=setup_requires,
install_requires=install_requires,
tests_require=tests_require,
extras_require=dict(
tests=tests_require,
docs=docs_require,
),
cmdclass={'test': PyTest},
entry_points={
'console_scripts': [
'diceware = diceware:main',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment