mirror of
https://github.com/KevinMidboe/python-gpiozero.git
synced 2025-12-08 20:39:01 +00:00
Make tests work reliably on the Pi
While the tests work well on a PC or Travis, the Pi (where I ought to be running them!) has some issues with the timing tests. Need to relax the tolerance of the "assert_states_and_times" method to 0.05 seconds otherwise it periodically fails even on something reasonably quick like a Pi 2 (less failures on a Pi 3 but still occasionally). Also reduced default fps to 25; if the default timing occasionally fails on a Pi 2 it's evidently too fast for a Pi 1 and shouldn't be the default; 25 also doesn't look any different to me on a pulsing LED. There's also a bunch of miscellaneous fixes in here; last minute typos and chart re-gens for the 1.2 release.
This commit is contained in:
@@ -374,7 +374,7 @@ class HoldMixin(EventsMixin):
|
||||
@hold_time.setter
|
||||
def hold_time(self, value):
|
||||
if value < 0:
|
||||
raise BadWaitTime('source_delay must be 0 or greater')
|
||||
raise BadWaitTime('hold_time must be 0 or greater')
|
||||
self._hold_time = float(value)
|
||||
|
||||
@property
|
||||
@@ -403,8 +403,8 @@ class HoldMixin(EventsMixin):
|
||||
The length of time (in seconds) that the device has been held for.
|
||||
This is counted from the first execution of the :attr:`when_held` event
|
||||
rather than when the device activated, in contrast to
|
||||
:attr:`active_time`. If the device is not currently held, this is
|
||||
``None``.
|
||||
:attr:`~EventsMixin.active_time`. If the device is not currently held,
|
||||
this is ``None``.
|
||||
"""
|
||||
if self._held_from is not None:
|
||||
return time() - self._held_from
|
||||
|
||||
Reference in New Issue
Block a user