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

Python 3.13 compatibility #1242

Closed
jamesjer opened this issue Jun 18, 2024 · 3 comments · Fixed by #1251
Closed

Python 3.13 compatibility #1242

jamesjer opened this issue Jun 18, 2024 · 3 comments · Fixed by #1251

Comments

@jamesjer
Copy link
Contributor

With python 3.13.0b2, 2 tests fail like this:

_____________ ERROR at setup of test_cm_config_log_only_if_changed _____________

tmp_path = PosixPath('/tmp/pytest-of-mockbuild/pytest-0/test_cm_config_log_only_if_cha0')

    @pytest.fixture()
    def cwd_tmp_path(tmp_path):
        # Run the whole test from inside tmp_path
>       with tmp_path.cwd():
E       TypeError: 'PosixPath' object does not support the context manager protocol

/builddir/build/BUILD/python-jupytext-1.16.2-build/jupytext-1.16.2/tests/conftest.py:50: TypeError

With python 3.11 and later, this works:

import contextlib

@pytest.fixture()
def cwd_tmp_path(tmp_path):
    # Run the whole test from inside tmp_path
    with contextlib.chdir(tmp_path):
        yield tmp_path
@mwouts
Copy link
Owner

mwouts commented Jun 20, 2024

Thanks @jamesjer for looking into this! That's very helpful. I guess we could code two different fixtures and activate either one depending on the Python version, then?

@jamesjer
Copy link
Contributor Author

Yes, I guess so. That seems kind of ugly, but I don't have any better ideas.

@mwouts
Copy link
Owner

mwouts commented Jun 30, 2024

I've prepared a PR, and as far as I can tell the suggested workaround seems to work. So far it's tested on the CI up to Python 3.12 as my CI seems to have an other independent issue with 3.13 (jupyterlab/maintainer-tools#242). Thanks @jamesjer anyway, we're getting close!

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.

2 participants