Skip to content

Commit 56d8e3f

Browse files
committed
Remove python setup.py test
Reorganized the tox.ini script so that a plain run of ``tox`` will run against a single interpreter. The "python setup.py test" command is no longer supported by setuptools and now emits a message that ``tox`` should be used. Fixes: #6 Change-Id: I72a2aab59dc6ea2b9b0f904417c6d6a0c6b60067
1 parent 4ffe500 commit 56d8e3f

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

setup.py

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,19 @@
2424
requires = ["SQLAlchemy>=1.1"]
2525

2626

27-
class PyTest(TestCommand):
28-
user_options = [("pytest-args=", "a", "Arguments to pass to py.test")]
29-
30-
def initialize_options(self):
31-
TestCommand.initialize_options(self)
32-
self.pytest_args = []
33-
34-
def finalize_options(self):
35-
TestCommand.finalize_options(self)
36-
self.test_args = []
37-
self.test_suite = True
27+
class UseTox(TestCommand):
28+
RED = 31
29+
RESET_SEQ = "\033[0m"
30+
BOLD_SEQ = "\033[1m"
31+
COLOR_SEQ = "\033[1;%dm"
3832

3933
def run_tests(self):
40-
# import here, cause outside the eggs aren't loaded
41-
import pytest
42-
43-
errno = pytest.main(self.pytest_args)
44-
sys.exit(errno)
34+
sys.stderr.write(
35+
"%s%spython setup.py test is deprecated by PyPA. Please invoke "
36+
"'tox' with no arguments for a basic test run.\n%s"
37+
% (self.COLOR_SEQ % self.RED, self.BOLD_SEQ, self.RESET_SEQ)
38+
)
39+
sys.exit(1)
4540

4641

4742
setup(
@@ -63,8 +58,7 @@ def run_tests(self):
6358
license="MIT",
6459
packages=find_packages(".", exclude=["examples*", "*.tests"]),
6560
include_package_data=True,
66-
tests_require=["pytest", "mock"],
67-
cmdclass={"test": PyTest},
61+
cmdclass={"test": UseTox},
6862
zip_safe=False,
6963
install_requires=requires,
7064
entry_points={

tox.ini

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
# content of: tox.ini , put in same dir as setup.py
21
[tox]
3-
envlist = py{27,36,37,38}-sqla{11,12,13,master}
2+
envlist = py
43

54
SQLA_REPO = {env:SQLA_REPO:git+https://github.com/sqlalchemy/sqlalchemy.git}
65

unreleased_changes/6.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.. change::
2+
:tags: bug, setup
3+
:tickets: 6
4+
5+
Reorganized the tox.ini script so that a plain run of ``tox`` will run
6+
against a single interpreter. The "python setup.py test" command is
7+
no longer supported by setuptools and now emits a message that ``tox``
8+
should be used.

0 commit comments

Comments
 (0)