]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Ignore ephemeral classes in test_all_present()
authorNils Philippsen <nils@tiptoe.de>
Sun, 12 Dec 2021 23:35:03 +0000 (18:35 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 14 Dec 2021 20:46:00 +0000 (15:46 -0500)
Fixed a regression in the test suite where the test called
``CompareAndCopyTest::test_all_present`` would fail on some platforms due
to additional testing artifacts being detected. Pull request courtesy Nils
Philippsen.

In some circumstances, ephemeral class objects that are created within
the scope of a test method don't seem to be garbage collected directly
on exit. Filter out classes created in test modules.

Fixes: #7450
Closes: #7451
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7451
Pull-request-sha: 135a8aaba2c6941460c7f45aa1a55c8f6b9eb43d

Change-Id: I621967bd916089dc1e3f98625fd2a852cd9fd712

doc/build/changelog/unreleased_14/7450.rst [new file with mode: 0644]
test/sql/test_compare.py

diff --git a/doc/build/changelog/unreleased_14/7450.rst b/doc/build/changelog/unreleased_14/7450.rst
new file mode 100644 (file)
index 0000000..56aaa1d
--- /dev/null
@@ -0,0 +1,9 @@
+.. change::
+    :tags: bug, tests, regression
+    :tickets: 7450
+
+    Fixed a regression in the test suite where the test called
+    ``CompareAndCopyTest::test_all_present`` would fail on some platforms due
+    to additional testing artifacts being detected. Pull request courtesy Nils
+    Philippsen.
+
index ca1eff62b4bce30d7b1e7a7b86a48fa82b969b12..06ebb0122722257b99dd097e401b818703bdba57 100644 (file)
@@ -1356,6 +1356,10 @@ class CompareAndCopyTest(CoreFixtures, fixtures.TestBase):
         ]
 
     def test_all_present(self):
+        """test for elements that are in SQLAlchemy Core, that they are
+        also included in the fixtures above.
+
+        """
         need = set(
             cls
             for cls in class_hierarchy(ClauseElement)
@@ -1363,9 +1367,9 @@ class CompareAndCopyTest(CoreFixtures, fixtures.TestBase):
             and (
                 "__init__" in cls.__dict__
                 or issubclass(cls, AliasedReturnsRows)
-                or "inherit_cache" not in cls.__dict__
             )
             and not issubclass(cls, (Annotated))
+            and cls.__module__.startswith("sqlalchemy.")
             and "orm" not in cls.__module__
             and "compiler" not in cls.__module__
             and "crud" not in cls.__module__