Skip to content

Commit

Permalink
Fixing up tests
Browse files Browse the repository at this point in the history
Some unencoded formats are *huge* (like BGRA) and on older Pi's this can
cause huge IO bottlenecks leading to common test failures, so bump the
minimum split-point wait timeout to 10 seconds.

Fixed up the image-effect test cleanup, and tweaked AWB gains test
(marginal failures on slow platforms - needed longer testing delay).
Finally, added missing warnings import.
  • Loading branch information
waveform80 committed Apr 24, 2016
1 parent ea3edd1 commit 8c50568
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions picamera/encoders.py
Original file line number Diff line number Diff line change
Expand Up @@ -979,9 +979,9 @@ def split(self, output, motion_output=None):
# intra_period / framerate gives the time between I-frames (which
# should also coincide with SPS headers). We multiply by three to
# ensure the timeout is deliberately excessive, and clamp the minimum
# timeout to 1 second (otherwise unencoded formats tend to fail
# timeout to 10 seconds (otherwise unencoded formats tend to fail
# presumably due to I/O capacity)
timeout = max(1.0, float(self._intra_period / self.parent.framerate) * 3.0)
timeout = max(10.0, float(self._intra_period / self.parent.framerate) * 3.0)
if not self.event.wait(timeout):
raise PiCameraRuntimeError(
'Timed out waiting for a split point')
Expand Down
1 change: 1 addition & 0 deletions picamera/frames.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
# Make Py2's str and range equivalent to Py3's
str = type('')

import warnings
from collections import namedtuple

from picamera.exc import (
Expand Down
4 changes: 2 additions & 2 deletions tests/test_attr.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def test_awb_gains(camera, previewing):

def check_gains(red, blue):
# The camera needs some time to let the AWB gains adjust
time.sleep(0.1)
time.sleep(0.2)
# The gains we get back aren't absolutely precise, but they're
# close (+/- 0.05)
r, b = camera.awb_gains
Expand Down Expand Up @@ -235,7 +235,7 @@ def test_image_effects1(camera, previewing):
camera.image_effect_params = params
assert camera.image_effect_params == params
finally:
camera.effect = 'none'
camera.image_effect = 'none'

def test_image_effects2(camera, previewing):
invalid_combinations = {
Expand Down

0 comments on commit 8c50568

Please sign in to comment.