]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
remove python setup.py test
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 26 Aug 2019 22:46:29 +0000 (18:46 -0400)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 26 Aug 2019 22:47:48 +0000 (18:47 -0400)
Removed the "python setup.py test" feature in favor of a straight run of
"tox".   Per Pypa / pytest developers, "setup.py" commands are in general
headed towards deprecation in favor of tox.  The tox.ini script has been
updated such that running "tox" with no arguments will perform a single run
of the test suite against the default installed Python interpreter.

.. seealso::

    https://github.com/pypa/setuptools/issues/1684

    https://github.com/pytest-dev/pytest/issues/5534

Change-Id: Ib92ef8d20ad0e6f1e1b9d25051b788788cc69b02
Fixes: #592
docs/build/unreleased/592.rst [new file with mode: 0644]
setup.py
tox.ini

diff --git a/docs/build/unreleased/592.rst b/docs/build/unreleased/592.rst
new file mode 100644 (file)
index 0000000..f25d33a
--- /dev/null
@@ -0,0 +1,15 @@
+.. change::
+    :tags: bug, setup
+    :tickets: 592
+
+    Removed the "python setup.py test" feature in favor of a straight run of
+    "tox".   Per Pypa / pytest developers, "setup.py" commands are in general
+    headed towards deprecation in favor of tox.  The tox.ini script has been
+    updated such that running "tox" with no arguments will perform a single run
+    of the test suite against the default installed Python interpreter.
+
+    .. seealso::
+
+        https://github.com/pypa/setuptools/issues/1684
+
+        https://github.com/pytest-dev/pytest/issues/5534
index ae875764e42deb025e21ac0161e4a82dbafef2e9..9574ac69877189f301306a6d25ef1971203141a7 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -26,24 +26,19 @@ requires = [
 ]
 
 
-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
+class UseTox(TestCommand):
+    RED = 31
+    RESET_SEQ = "\033[0m"
+    BOLD_SEQ = "\033[1m"
+    COLOR_SEQ = "\033[1;%dm"
 
     def run_tests(self):
-        # import here, cause outside the eggs aren't loaded
-        import pytest
-
-        errno = pytest.main(self.pytest_args)
-        sys.exit(errno)
+        sys.stderr.write(
+            "%s%spython setup.py test is deprecated by pypa.  Please invoke "
+            "'tox' with no arguments for a basic test run.\n%s"
+            % (self.COLOR_SEQ % self.RED, self.BOLD_SEQ, self.RESET_SEQ)
+        )
+        sys.exit(1)
 
 
 setup(
@@ -77,7 +72,7 @@ setup(
     packages=find_packages(".", exclude=["examples*", "test*"]),
     include_package_data=True,
     tests_require=["pytest!=3.9.1,!=3.9.2", "mock", "Mako"],
-    cmdclass={"test": PyTest},
+    cmdclass={"test": UseTox},
     zip_safe=False,
     install_requires=requires,
     entry_points={"console_scripts": ["alembic = alembic.config:main"]},
diff --git a/tox.ini b/tox.ini
index bb19bb1f7a4fdc74eeceaebccd0cebadafd3f635..98b05143b169114a3e562141ff9b4c4339ab45a9 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -1,6 +1,6 @@
 [tox]
 
-envlist = py{27,34,35,36,37}-sqla{11,12,13,master}
+envlist = py
 
 SQLA_REPO = {env:SQLA_REPO:git+https://github.com/sqlalchemy/sqlalchemy.git}
 
@@ -51,9 +51,8 @@ commands=
   {oracle,mssql}: python reap_dbs.py db_idents.txt
 
 
-# thanks to https://julien.danjou.info/the-best-flake8-extensions/
 [testenv:pep8]
-basepython = python3.7
+basepython = python3
 deps=
       flake8
       flake8-import-order