-
-
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
Enable testing with Python 3.11 #9511
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.
LGTM
It seems like it's failing now - do you intend to fix the problems before merging, or merge just without marking the py311 checks as required?
BTW, this post is relevant: https://sethmlarson.dev/blog/python-prereleases-and-pip-cache though not sure if it affects our setup.
I'm not sure I will have time to tackle this soon, but I think it would still be valuable to merge this regardless, as at least this problems will be visible in general. But let's see what others think. |
committed fixes to your branch -- hope you don't mind <3 |
testing/python/metafunc.py
Outdated
@@ -455,7 +455,10 @@ def test_idmaker_enum(self) -> None: | |||
enum = pytest.importorskip("enum") | |||
e = enum.Enum("Foo", "one, two") | |||
result = idmaker(("a", "b"), [pytest.param(e.one, e.two)]) | |||
assert result == ["Foo.one-Foo.two"] | |||
if sys.version_info >= (3, 11): | |||
assert result == ["one-two"] |
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.
Looks like they went ahead with the Enum str change, which means the nodeids for tests parametrized with enums changes. I think the new ID is better, but we should probably keep the old format for backward compat. But we should make it consistent between versions either way.
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.
eh, I kinda disagree -- we shouldn't deviate from python's behaviour unless there's a very good reason to do so (as it subverts expectations and creates a "surprise")
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.
You mean that you think the node ID should be allowed to differ between versions? Many people run pytest on several versions, and for things like -k
, reporting, plugins, etc I think it's expected that the node IDs would be the same.
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.
yeah I think they should differ between versions
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.
structurally this will lead to false test inequality, which makes test result aggregation a total mess ^^
maybe we can test this with better test ids tho
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.
While I understand @bluetech's reasoning, I'm leaning towards Anthony here, because I think it is reasonable for pytest to use Enum's str representation in the node id and "wash his hands".
If in the end the user impact is minimal and justified in cases like this, I think it is best to lean towards our own maintenance sanity. I can envision for example, if we were to know have special handling for enums, for that to change again in a future Python release and break this again, but now it would be "our fault" because we took responsibility for that feature. Also users often pass their own objects to parametrize and their str representation is used, which could differ between versions as well.
My PR actions/setup-python#303 has been merged and released which fixed that too: a fresh cache is created for new patch/alpha/beta/RC versions (actions/setup-python#319 (comment)). |
Of course not, thanks a bunch. 👍 I will rebase this now and see how it fares. |
We should add Python 3.11 to our testing matrix in order to antecipate possible problems (even if we don't attempt to solve any of them right away).
RuntimeWarning: Running interpreter doesn't sufficiently support code object introspection. Some features like bare super() or accessing __class__ will not work with slotted classes.
Weird, I thought we had sorted this out: https://github.com/pytest-dev/pytest/runs/5156307323?check_suite_focus=true
|
huh weird -- does github actions not have |
Yep, GitHub has the newest alpha 5 as well. If you use |
Using
But we now get two failures: https://github.com/pytest-dev/pytest/runs/5157307611?check_suite_focus=true
|
heh looks like it got reverted again -- fortunately you can rebase out just the one commit I had python/cpython@42a64c0 |
Thanks everyone! |
[7.0.x] Enable testing with Python 3.11 (#9511)
We should add Python 3.11 to our testing matrix in order to antecipate possible problems (even if we don't attempt to solve any of them right away).