mirror of
https://github.com/httpie/cli.git
synced 2025-08-19 10:21:57 +02:00
Use a more modern approach to run tests (#1089)
Running tests through `python setup.py test` is deprecated: > WARNING: Testing via this command is deprecated and will be removed > in a future version. Users looking for a generic test entry point > independent of test runner are encouraged to use tox. I am not in favor of moving back to `tox`, we should simply run tests using `python -m pytest` (or `make test`) and that's it. A new extra was added, `dev`, to install development requirements: $ python -m pip install --upgrade --editable '.[dev]'
This commit is contained in:
committed by
GitHub
parent
da03a0656e
commit
9857693ebf
44
setup.py
44
setup.py
@@ -4,39 +4,26 @@ import sys
|
||||
import codecs
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
from setuptools.command.test import test as TestCommand
|
||||
|
||||
import httpie
|
||||
|
||||
|
||||
class PyTest(TestCommand):
|
||||
"""
|
||||
Running `$ python setup.py test' simply installs minimal requirements
|
||||
and runs the tests with no fancy stuff like parallel execution.
|
||||
|
||||
"""
|
||||
|
||||
def finalize_options(self):
|
||||
TestCommand.finalize_options(self)
|
||||
self.test_args = [
|
||||
'--doctest-modules',
|
||||
'--verbose',
|
||||
'./httpie',
|
||||
'./tests',
|
||||
]
|
||||
self.test_suite = True
|
||||
|
||||
def run_tests(self):
|
||||
import pytest
|
||||
sys.exit(pytest.main(self.test_args))
|
||||
|
||||
|
||||
# Note: keep requirements here to ease distributions packaging
|
||||
tests_require = [
|
||||
'pytest-httpbin',
|
||||
'docutils',
|
||||
'pytest',
|
||||
'pytest-httpbin>=0.0.6',
|
||||
]
|
||||
dev_require = [
|
||||
*tests_require,
|
||||
'flake8',
|
||||
'flake8-comprehensions',
|
||||
'flake8-deprecated',
|
||||
'flake8-mutable',
|
||||
'flake8-tuple',
|
||||
'pytest-cov',
|
||||
'twine',
|
||||
'wheel',
|
||||
]
|
||||
|
||||
|
||||
install_requires = [
|
||||
'requests[socks]>=2.22.0',
|
||||
'Pygments>=2.5.2',
|
||||
@@ -59,6 +46,7 @@ if 'bdist_wheel' not in sys.argv:
|
||||
|
||||
# bdist_wheel
|
||||
extras_require = {
|
||||
'dev': dev_require,
|
||||
'test': tests_require,
|
||||
# https://wheel.readthedocs.io/en/latest/#defining-conditional-dependencies
|
||||
':sys_platform == "win32"': install_requires_win_only,
|
||||
@@ -91,8 +79,6 @@ setup(
|
||||
python_requires='>=3.6',
|
||||
extras_require=extras_require,
|
||||
install_requires=install_requires,
|
||||
tests_require=tests_require,
|
||||
cmdclass={'test': PyTest},
|
||||
classifiers=[
|
||||
'Development Status :: 5 - Production/Stable',
|
||||
'Programming Language :: Python',
|
||||
|
Reference in New Issue
Block a user