]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
use SQLAlchemy's xdist methods
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 4 Mar 2024 04:11:50 +0000 (23:11 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 4 Mar 2024 04:39:07 +0000 (23:39 -0500)
Fixes to support pytest 8.1 for the test suite.

the use of teardown() was based on pytest's nose
compat, which is removed.  their xdist style tests use the name
"setup_method()" and "teardown_method()" now.

We have SQLAlchemy's pytestplugin in use which uses pytest fixtures
to invoke our own xdist style setUp and tearDown methods, which we
are already using here, so use those for this one test.

Fixes: #1435
Change-Id: I4c49e81fca6bfa957594714009531fe12691ace5

docs/build/unreleased/1435.rst [new file with mode: 0644]
tests/test_command.py
tox.ini

diff --git a/docs/build/unreleased/1435.rst b/docs/build/unreleased/1435.rst
new file mode 100644 (file)
index 0000000..8f9e4cd
--- /dev/null
@@ -0,0 +1,5 @@
+.. change::
+    :tags: bug, tests
+    :tickets: 1435
+
+    Fixes to support pytest 8.1 for the test suite.
index c665f95556deed81c09b8ff9c405c620191e4f53..04a624adec37361265880066deb3f2263487839d 100644 (file)
@@ -64,7 +64,7 @@ class HistoryTest(_BufMixin, TestBase):
     def teardown_class(cls):
         clear_staging_env()
 
-    def teardown(self):
+    def tearDown(self):
         self.cfg.set_main_option("revision_environment", "false")
 
     @classmethod
@@ -206,13 +206,12 @@ finally:
 
 
 class RevisionEnvironmentTest(_BufMixin, TestBase):
-    @classmethod
-    def setup(cls):
-        cls.env = staging_env()
-        cls.cfg = _sqlite_testing_config()
-        cls._setup_env_file()
+    def setUp(self):
+        self.env = staging_env()
+        self.cfg = _sqlite_testing_config()
+        self._setup_env_file()
 
-    def teardown(self):
+    def tearDown(self):
         self.cfg.set_main_option("revision_environment", "false")
         clear_staging_env()
 
@@ -1144,7 +1143,7 @@ class CommandLineTest(TestBase):
         cls.cfg = _sqlite_testing_config()
         cls.a, cls.b, cls.c = three_rev_fixture(cls.cfg)
 
-    def teardown(self):
+    def tearDown(self):
         os.environ.pop("ALEMBIC_CONFIG", None)
 
     @classmethod
diff --git a/tox.ini b/tox.ini
index 3b4c1ff7768777f50ebe18a2b99629d57e81649d..4b0f082bd7ae23924b897220d848f5298847f4ad 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -8,7 +8,7 @@ SQLA_REPO = {env:SQLA_REPO:git+https://github.com/sqlalchemy/sqlalchemy.git}
 [testenv]
 cov_args=--cov=alembic --cov-report term --cov-report xml
 
-deps=pytest>4.6
+deps=pytest>4.6,<8.2
      pytest-xdist
      sqla13: pytest<7
      sqla13: {[tox]SQLA_REPO}@rel_1_3#egg=sqlalchemy