-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
0.15
is extrmemely slow and fails on lots of tests
#176
Comments
I will look into it |
thank you. |
I made some progress. The tests in this branch pydantic/pydantic-ai#658 are working for cpython>=3.11. I found the following problems. ModelResponse.from_textI assume that you (or someone else) changed the generated snapshot code to make use of I fixed it for now by adding assert result.all_messages() == snapshot(
[
ModelRequest(parts=[UserPromptPart(content='Hello', timestamp=IsNow(tz=timezone.utc))]),
Is(ModelResponse.from_text(content='Hello world', timestamp=IsNow(tz=timezone.utc))),
ModelRequest(parts=[UserPromptPart(content='Hello', timestamp=IsNow(tz=timezone.utc))]),
Is(ModelResponse.from_text(content='Hello world', timestamp=IsNow(tz=timezone.utc))),
]
) I would also like to know why you changed this code. Was there some problem with the generated code? I think about adding a way to tell inline-snapshot that it should use alternative class methods to construct a object. This would allow inline-snapshot to fix the value if it changes later. But this has nothing to do with this bug and is maybe something for a new feature in the future. IsNowYou where right IsNow slows inline-snapshot down. I currently don't know why this happen, but I found a interesting work around. import dirty_equals
OldIsNow = dirty_equals.IsNow
def newIsNow(*a: Any, **ka: Any):
# this has a big effect on the test runtime
# tests are passing in both cases
# ~ 4min
# (the delta is required to make the tests work)
# return OldIsNow(*a,**ka,delta=50)
# 16 sec
return dirty_equals.AnyThing()
dirty_equals.IsNow = newIsNow I will try to figure the difference between |
@samuelcolvin I found the reason for the slow tests. Can you please create a new dirty-equals release? |
Sorry about that, I'll do a release asap. |
Regarding |
|
I have reverted it to the representation used by inline-snapshot. The tests are working again. I also found it very cumbersome to change the timestamps back to IsNow, which inspired me to #177. Let me know if you have similar issues when you are working with inline-snapshot. |
I'm not really sure what's going on, but pydantic/pydantic-ai#657 should demonstrate the problem - all it's doing is upgrading from 0.14 to 0.15 and everything starts breaking.
It's possible that the tests on
IsNow
are failing just because inline-snapshot comparison is so slow that the datetime's being compared to are no longer close to "now".It's worth saying that due to #174 I'm currently having to switch back and fourth between diffferent versions to run all tests and generate snapshots! @15r10nk I'd really appreciate some help on this.
I've tried the latest release (v0.18 I think) and i'm see the exact same behaviour as 0.15.
The text was updated successfully, but these errors were encountered: