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
Rain test fails randomly #359
Comments
|
Interesting... I completely agree that future stability is important, but will struggle to test this as I don't have an openSUSE build env. First thing to check here is how reproducible this failure is... These tests are for deliberately randomized effects and so sometimes hit failures due to the random seed. If so, I can tweak the warm up for this test to let it run a little before checking output. Does this always fail like this, or was it a one off? |
|
Hmm. I cannot reproduce it anymore, so it probably really is more of a random failure, independent of the date. |
|
Yeah - seeding the RNG is a good idea. I'll push something to master. |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
Naughty stalebot! I'll fix this... |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
I added --- asciimatics-1.14.0.orig/asciimatics/effects.py
+++ asciimatics-1.14.0/asciimatics/effects.py
@@ -12,7 +12,7 @@ from builtins import object
from builtins import range
from future.utils import with_metaclass
from abc import ABCMeta, abstractmethod, abstractproperty
-from random import randint, random, choice
+from random import randint, random, choice, seed
from math import sin, cos, pi
from asciimatics.paths import DynamicPath
from asciimatics.screen import Screen
@@ -54,6 +54,7 @@ class Effect(with_metaclass(ABCMeta, obj
:param stop_frame: Stop index for the effect.
:param delete_count: Number of frames before this effect is deleted.
"""
+ seed(42)
self._screen = screen
self._start_frame = start_frame
self._stop_frame = stop_frame |
|
Interesting... Given that the random numbers are deterministic once the seed is set, the only reason it wouldn't follow the same path is because of some systemic difference. Are you running the test with multiple threads, or something like that? |
|
My guess is that randomness is used before tests run asciimatics/asciimatics/effects.py Line 509 in 31b3fe5
Which is why it became deterministic when adding it early in |
|
That doesn't quite make sense. Those should only get invoked once the class is constructed (i.e. in the test). I'd also like to avoid seeding inside the real code... Did you try using the setUp() method of the unittest class to set the seed? Something like this: |
Describe the bug
Rain test fails after 2038-01-19
To Reproduce
on openSUSE, I build the package with
osc co openSUSE:Factory/python-asciimatics osc build --vm-type=kvm --noservice --clean --build-opt=--vm-custom-opt="-rtc base=2038-01-20T00:00:00" --alternative-project=home:bmwiedemann:reproducible openSUSE_TumbleweedExpected behavior
tests should continue to pass in future
Screenshots
System details (please complete the following information):
Additional context
See also https://en.wikipedia.org/wiki/Year_2038_problem
As part of my work on reproducible builds for openSUSE, I check that software still gives identical build results in the future.
The usual offset is +16 years, because that is how long I expect some software will be used in some places.
This showed up failing tests in our package build.
See https://reproducible-builds.org/ for why this matters.
The text was updated successfully, but these errors were encountered: