Skip to content
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

Fix Python 3.12 errors #2646

Closed
A5rocks opened this issue May 22, 2023 · 9 comments · Fixed by #2829
Closed

Fix Python 3.12 errors #2646

A5rocks opened this issue May 22, 2023 · 9 comments · Fixed by #2829

Comments

@A5rocks
Copy link
Contributor

A5rocks commented May 22, 2023

Now that Python 3.12 is entering its beta releases (as of today, according to PEP 693), there should no longer be any feature additions. This means it's going to be more stable, I hope. So, it's time to start poking at test failures!!

https://github.com/python-trio/trio/actions/runs/5013776086/jobs/8987273168 shows that currently pytest is... broken on Python 3.12. That's inconvenient. We are going to be waiting on pytest-dev/pytest#10981 to merge, I guess! I'll keep this issue updated.

@jakkdl
Copy link
Member

jakkdl commented May 22, 2023

We can for the moment just suppress that particular DeprecationWarning by adding 'ignore:ast.Str is deprecated:DeprecationWarning', to filterwarnings in pyproject.toml https://docs.pytest.org/en/6.2.x/warnings.html

It also looks like test_nursery_cancel_doesnt_create_cyclic_garbage is failing, I looked into it a little bit the other day and it looked like toggle_collected() was called, but collected didn't get set to True, so I have no clue what's going on there.

async def test_nursery_cancel_doesnt_create_cyclic_garbage():
# https://github.com/python-trio/trio/issues/1770#issuecomment-730229423
def toggle_collected():
nonlocal collected
collected = True
collected = False
gc.collect()
old_flags = gc.get_debug()
try:

@A5rocks
Copy link
Contributor Author

A5rocks commented May 22, 2023

For that one specifically, I've already raised a CPython issue (python/cpython#100964) but I need to investigate and respond, heh.

I remember seeing others, though. I suspect it's not worth the effort to ignore the warning as the pytest PR should merge whenever the beta comes out.

@jakkdl
Copy link
Member

jakkdl commented May 25, 2023

I would love to have a quick patch that silences the 3.12 errors. When actively developing I find it's nice to be able to peek at the PR list and see if tests are failing or not - without having to check the long test list every time. And I also have it set up to get notifications on failing CI tests, which becomes ... not useful.

(codecov not handling windows is also at fault here, but that one's at least somewhat possible to work around)

@webknjaz
Copy link
Member

(codecov not handling windows is also at fault here, but that one's at least somewhat possible to work around)

AFAIU, the current test runner uses a codecov uploader version that's been deprecated 3 years ago: #2650.

@webknjaz
Copy link
Member

We can for the moment just suppress that particular DeprecationWarning by adding 'ignore:ast.Str is deprecated:DeprecationWarning', to filterwarnings in pyproject.toml

Plz attach a comment to that line explaining when it can be removed, if you do so.. Alternatively, I've been experimenting with adding ignore filters dynamically, like this: https://github.com/cherrypy/cheroot/blob/f82aee6/cheroot/test/_pytest_plugin.py#L22.

@A5rocks
Copy link
Contributor Author

A5rocks commented May 29, 2023

OK now that #2651 is merged, here's a list of failing tests:

  • test_run.py::test_calling_asyncio_function_gives_nice_error
  • test_run.py::test_permanently_detach_coroutine_object
  • test_run.py::test_nursery_cancel_doesnt_create_cyclic_garbage
  • test_exports.py::test_static_tool_sees_all_symbols[pylint-trio.socket]
  • test_exports.py::test_static_tool_sees_all_symbols[jedi-trio.socket]
  • test_exports.py::test_static_tool_sees_all_symbols[mypy-trio]
  • test_exports.py::test_static_tool_sees_all_symbols[mypy-trio.abc]
  • test_exports.py::test_static_tool_sees_all_symbols[mypy-trio.socket]
  • test_exports.py::test_static_tool_sees_class_members[jedi-trio]
  • test_exports.py::test_static_tool_sees_class_members[mypy-trio]
  • test_tracing.py::test_task_iter_await_frames
  • test_tracing.py::test_task_iter_await_frames_async_gen

Most of the static ones seem solvable by us, by either adding exports or ignoring more deprecation warnings. I'm not so sure about the other ones, let's xfail them after brief investigation into each.

@A5rocks
Copy link
Contributor Author

A5rocks commented Jun 10, 2023

As of master, it looks like maybe CPython reverted some breaking changes? There's only one error left; the one I already made an issue about! (https://github.com/python-trio/trio/actions/runs/5221533766/jobs/9425911997#step:5:1737)

@jakkdl
Copy link
Member

jakkdl commented Jun 10, 2023

Wohoo! Sounds like time for a PR that marks it as xfail, and then we ... might have fully passing tests?!?! (other than some remaining codecov problems)

@A5rocks
Copy link
Contributor Author

A5rocks commented Jun 11, 2023

Sure, feel free to make that PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants