-
Notifications
You must be signed in to change notification settings - Fork 15
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 freezing doesn't work properly with zyte-common-items #125
Comments
We should remove fractional seconds from If all time values we use and compare have precision only in seconds, time ticking for less that a second will not cause problems. If a test runs (i.e. the page object generates the item) for longer than 1 second, we need a way to compare values with a margin, as discussed earlier. |
Wouldn't it be an issue for faster tests if the current time is XX:XX:59.9999, and then time moves forward? I wonder if we need some weird workaround, e.g. waiting for a minute to start before recording the time :) |
What's the workaround for the users if the issue happens (e.g. because extraction takes more than a second)? Is it to change either frozen_time or dateDownloaded manually to make them match? |
If
For now? Probably yes, but only if you now that e.g. dateDownloaded is always 1 second later than frozen_time. If it's not that deterministic, I don't see a good workaround. |
Partially addressed by scrapinghub/scrapy-poet#122. |
Unfortunately having test generation take more than 1 second is easy, especially with additional requests, when using scrapy-poet for that. Initializing the spider and waiting for the server response, or several responses, can easily take more than 1 second. Though it's easy to change |
I tried to use scrapy-poet's savefixture together with Product item from zyte-common-items. The result:
meta.json:
output.json:
And then, comparison fails when running pytest, on a freshly generated fixture:
Seems to be some issue with rounding, but I'm not sure; haven't checked it. Another possibile explanation is that without freezing the time during test generation the time can change.
The text was updated successfully, but these errors were encountered: