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

time-machine test dependency is problematic for PyPy3 #132

Closed
mgorny opened this issue Nov 7, 2024 · 6 comments
Closed

time-machine test dependency is problematic for PyPy3 #132

mgorny opened this issue Nov 7, 2024 · 6 comments

Comments

@mgorny
Copy link

mgorny commented Nov 7, 2024

I'm sorry to be bothering you but the time-machine test dependency that is present right now makes it impossible to run over 200 tests on PyPy3. time-machine relies on patching internals of CPython's _datetime implementation, and as such is not installable on PyPy3 at all.

Could you please consider using e.g. pytest-freezer instead? This one's portable and works across all Python implementations.

Unfortunately, PyPy3 support became important right now because pydantic-core started using inline-snapshot, and its consumers do support PyPy3.

@15r10nk
Copy link
Owner

15r10nk commented Nov 7, 2024

the time-machine problem is not so big. The PyPy3 support is a bigger problem. This could take a while.

@mgorny
Copy link
Author

mgorny commented Nov 7, 2024

Oh, I've assumed that the lack of time_machine is the only problem. But from a quick patch, indeed I've seem to be still getting 192 failures.

If that's any help, my patch was:

diff --git a/tests/conftest.py b/tests/conftest.py
index 5ef37fc..8a69dc2 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -268,8 +268,8 @@ import datetime
 import pytest
 
 @pytest.fixture(autouse=True)
-def set_time(time_machine):
-        time_machine.move_to(datetime.datetime(2024, 3, 14, 0, 0, 0, 0),tick=False)
+def set_time(freezer):
+        freezer.move_to(datetime.datetime(2024, 3, 14, 0, 0, 0, 0))
         yield
 """
             )

@15r10nk
Copy link
Owner

15r10nk commented Nov 8, 2024

@mgorny could you please tell me if this fix would solve your issue for now?

I hope to provide support for pypy in the long term, but this might take a while.

@15r10nk
Copy link
Owner

15r10nk commented Nov 8, 2024

and I also know that I have a "Programming Language :: Python :: Implementation :: PyPy" classifier in my pyproject.toml ... I will fix this too.

@15r10nk
Copy link
Owner

15r10nk commented Nov 11, 2024

0.14.0 official supports pypy. But I removed the PYPY classifier because the code rewriting does not currently work.

@15r10nk 15r10nk closed this as completed Nov 11, 2024
@mgorny
Copy link
Author

mgorny commented Nov 11, 2024

Thanks!

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

No branches or pull requests

2 participants