-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add free-threaded CPython 3.13t to CI #12550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unclear if the tests run here? we've noted there's a lot not working with current python sqlite3 so how are you running the tests ?
@@ -1585,7 +1586,7 @@ def predictable_gc(self): | ||
gc.collect() is called, as well as clean out unreferenced subclasses. | ||
|
||
""" | ||
return self.cpython | ||
return self.cpython and not bool(sysconfig.get_config_var("Py_GIL_DISABLED")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would make a new requirement (that is, a function inside this file) called gil_enabled
and use that where needed
test/aaa_profiling/test_memusage.py
Outdated
@@ -54,6 +56,11 @@ | ||
from ..orm import _fixtures | ||
|
||
|
||
pytestmark = pytest.mark.skipif( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed, use gil_enabled
req
test/aaa_profiling/test_memusage.py
Outdated
@@ -1051,6 +1058,12 @@ def test_many_discarded_relationships(self): | ||
"""a use case that really isn't supported, nonetheless we can | ||
guard against memleaks here so why not""" | ||
|
||
import sysconfig |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed, use gil_enabled
req on test_many_discarded_relationships
e.g. for this one and the rest:
@testing.requires.gil_enabled
def test_many_discarded_relationships()
test/base/test_events.py
Outdated
import sysconfig | ||
import pytest | ||
|
||
if bool(sysconfig.get_config_var("Py_GIL_DISABLED")): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed, use gil_enabled
req
import sysconfig | ||
import pytest | ||
|
||
if bool(sysconfig.get_config_var("Py_GIL_DISABLED")): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed, use gil_enabled
req
test/orm/declarative/test_mixin.py
Outdated
import sysconfig | ||
import pytest | ||
|
||
if bool(sysconfig.get_config_var("Py_GIL_DISABLED")): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed, use gil_enabled
req
test/orm/test_events.py
Outdated
import sysconfig | ||
import pytest | ||
|
||
if bool(sysconfig.get_config_var("Py_GIL_DISABLED")): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not needed, use gil_enabled
req
Thanks for the review @zzzeek, I've been running the tests (without any parallelism) using tox, sqlite issues arise when tests are run in parallel |
@@ -134,6 +135,7 @@ jobs: | ||
- "3.11" | ||
- "3.12" | ||
- "3.13" | ||
- "3.13t" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think it's needed here
@property | ||
def gil_enabled(self): | ||
"""Test should run if the Python distribution is GIL-enabled.""" | ||
return bool(sysconfig.get_config_var("Py_GIL_DISABLED")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the canonical way to check for this is with sys._is_gil_enabled()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, this is sqla-tester setting up my work on behalf of zzzeek to try to get revision 7600297 of this pull request into gerrit so we can run tests and reviews and stuff
New Gerrit review created for change 7600297: https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/5896 |
Random q pytest-run-parallel, I'm enabling by using If I just run some of our simplest suites, like the test/sql/test_query suite:
"60 tests were not run in parallel because of use of thread-unsafe functionality". It can list out the tests that were parallel or not parallel, but it tells me nothing about what "thread unsafe functionality" is involved. Maybe that's because of sqlite? OK so I tried running them against the psycopg2 driver instead, which is definitely threadsafe:
same exact message: "60 tests were not run in parallel because of use of thread-unsafe functionality, " Shouldn't there be a way for the plugin to list out what functionality is thread-unsafe? |
per https://github.com/Quansight-Labs/pytest-run-parallel ". If a test was not run in a thread pool because pytest-run-parallel detected use of thread-unsafe functionality, the reason will be printed as well."
full output is below, I see no reasons? am I doing something wrong?
|
@zzzeek thanks for the follow-up, I might need to take a look to the test, maybe there's a function that is declared as thread-unsafe and it's not being reported? |
I think I was running the tests just on main. The pytest parallel plugin ran the tests, made the decision to not parallelize a bunch, and did not express any messaging why it made this decision, in contradiction to what the docs say. So this seems like a bug in pytest parallel. If the tool is going to make implicit decisions, it should log the origin of these decisions |
Description
See #12513
This PR enables free-threaded CPython 3.13t as a supported target in the CI tests, as outlined in the discussion, this PR only tests sqlalchemy without any kind of parallelism, i.e., using
pytest-run-parallel
. Most of the changes are related to test skips when garbage collection timing or memory usage collection takes place, since the free-threaded distribution behaves differently from the GIL-enabled one on these aspects, otherwise, all tests are passing locally.Checklist
This pull request is:
must include a complete example of the issue. one line code fixes without an
issue and demonstration will not be accepted.
Fixes: #<issue number>
in the commit messageinclude a complete example of how the feature would look.
Fixes: #<issue number>
in the commit messageHave a nice day!