summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/util/_has_cy.py
diff options
context:
space:
mode:
authorArie Bovenberg <a.c.bovenberg@gmail.com>2022-02-06 16:37:02 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2022-02-07 13:51:11 -0500
commit38cdd3946c337f3d917218cd1c8da67a971646ee (patch)
treeb84f1588556cfd62b67d629dc8db6d61c6f4870b /lib/sqlalchemy/util/_has_cy.py
parent0566df2f79c7aae978bc0ef8e253cfcc4de54ecc (diff)
downloadsqlalchemy-38cdd3946c337f3d917218cd1c8da67a971646ee.tar.gz
add slotscheck to CI
As discussed in #7589, `slotscheck` can prevent slots-related mistakes from creeping back in. Plan for now is to have slotscheck part of the "lint" tests (renamed from pep8) that will run for CI and github actions. To support slotscheck's runtime nature, slotscheck is run twice, first with cython exts enabled and then with them disabled via new environment variable. Also added sqlalchemy[mypy] dependency to support slots checking the mypy plugin. Found and fixed one more `__slots__` issue by disabling C exts. Closes: #7670 Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/7670 Pull-request-sha: 3e77fe5449615a3c7c61ce9a1e4e79cd6636a89a Change-Id: I90cdd284cdcee316a38856ba94d72ffc98947c5a
Diffstat (limited to 'lib/sqlalchemy/util/_has_cy.py')
-rw-r--r--lib/sqlalchemy/util/_has_cy.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/sqlalchemy/util/_has_cy.py b/lib/sqlalchemy/util/_has_cy.py
index bf251b5b5..b09338f21 100644
--- a/lib/sqlalchemy/util/_has_cy.py
+++ b/lib/sqlalchemy/util/_has_cy.py
@@ -1,11 +1,15 @@
+import os
import typing
if not typing.TYPE_CHECKING:
- try:
- from ..cyextension import util # noqa
- except ImportError:
+ if os.environ.get("DISABLE_SQLALCHEMY_CEXT_RUNTIME"):
HAS_CYEXTENSION = False
else:
- HAS_CYEXTENSION = True
+ try:
+ from ..cyextension import util # noqa
+ except ImportError:
+ HAS_CYEXTENSION = False
+ else:
+ HAS_CYEXTENSION = True
else:
HAS_CYEXTENSION = False