-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Python 3.12 support #10894
Python 3.12 support #10894
Conversation
"ubuntu-pypy3", | ||
|
||
"macos-py37", | ||
"macos-py38", |
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.
Probably good to leave a comment here explaining why we are skipping macos-py38.
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 noticed macos-py311 was missing, so I added py312 and removed py38 to keep the job count the same. With the faster Python release cycle, it is starting to become a lot.
The xmlschema problem is fixed. Now there is a test failure on windows. I don't have windows but seems like a simple issue, will try to fix it.
Job: https://github.com/pytest-dev/pytest/actions/runs/4704035427/jobs/8343245002 |
The failure doesn't make sense to me. Relevant code in class Stat:
...
def __getattr__(self, name: str) -> Any:
return getattr(self._osstatresult, "st_" + name)
def __init__(self, path, osstatresult):
self.path = path
self._osstatresult = osstatresult
@property
def owner(self):
if iswin32:
raise NotImplementedError("XXX win32")
import pwd
entry = error.checked_call(pwd.getpwuid, self.uid) # type:ignore[attr-defined]
return entry[0]
... The failing test ( def test_owner_group_not_implemented(self, path1):
with pytest.raises(NotImplementedError):
path1.stat().owner fails as seen in previous comment. How come the I reran the job and it happened again so it's reproducible. |
You are right, it does not make much sense. I debugged it, and here is what happens in 3.12:
In Python 3.10 (and I supposed 3.11 but I did not test), 2) never happens -- Seems like a bug in CPython, I will post an issue upstream. EDIT: posted upstream: python/cpython#103551 |
This has been fixed already and will be available on the next release. 👍 |
|
Hmm some autocommit hook deletes the classifier so I'll drop it for now. |
@bluetech you can probably up the max version in the setup.cfg firmat hook config |
Yes, it's this: https://github.com/asottile/setup-cfg-fmt#adds-python-version-classifiers diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index af6cd262..fbd5d39c 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -50,7 +50,7 @@ repos:
rev: v2.2.0
hooks:
- id: setup-cfg-fmt
- args: ["--max-py-version=3.11", "--include-version-classifiers"]
+ args: ["--max-py-version=3.12", "--include-version-classifiers"]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks: |
Thanks, missed that. |
github updated to Python 3.12 beta, I reran the job and now there is a new deprecation (showing one, rest are the same):
Fixing. |
Added this to the ast deprecations commit: diff --git a/src/_pytest/assertion/rewrite.py b/src/_pytest/assertion/rewrite.py
index 2f9038ee1..00bb4feb9 100644
--- a/src/_pytest/assertion/rewrite.py
+++ b/src/_pytest/assertion/rewrite.py
@@ -688,7 +688,10 @@ class AssertionRewriter(ast.NodeVisitor):
and isinstance(item, ast.Expr)
and isinstance(item.value, astStr)
):
- doc = item.value.s
+ if sys.version_info >= (3, 8):
+ doc = item.value.value
+ else:
+ doc = item.value.s
if self.is_rewrite_disabled(doc):
return
expect_docstring = False Some more errors now, fixing these too: Details
|
Pushed a fix for
They stem from what seems like tokenization changes around line continuations. Given the following code def x():
assert 1 + \
2 tokenizes as follows in Python 3.11:
and as follows in Python 3.12:
Will look at it some other time (unless someone beats me to it, which would be great). |
cc @asottile on previous comment, you know tokenization better than anyone, maybe you have an idea :) |
yeah that's all to be expected. the DEDENT might change back to be less disruptive in python/cpython#104976 |
Thanks, I see the PR is merged now, so let's wait for the next beta. |
3.12.0b2 is now out: |
Since Python 3.12, setuptools is no longer installed by default in venvs. We have a test which uses it, so add it to the testing extra.
When testing -dev python versions, we want to always use the latest.
I see now that it needs to appear in https://github.com/actions/python-versions/blob/main/versions-manifest.json not in the releases. |
Yup, I believe actions/python-versions#232 is the thing to watch. |
actions/python-versions#232 has been merged and beta 2 is now available (for example). |
OK this is good to go now, marked as ready for review. |
(I changed the branch protection checks already so this can be green) |
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.
Great work ! Just curious, I wonder if the python 3.7 specific code path will be removed in 2 weeks for python 3.7 eol ? Is there also a 'cleanup' of the code when removing support for an interpreter ?
Yes, I believe our policy is that new pytest feature releases only support non-EOL python versions. Then we also clean up all of the compat code for that version. |
This is currently blocked on sissaschool/xmlschema#342.Blocked on python 3.12-beta.2 release in https://github.com/actions/python-versions/blob/main/versions-manifest.json