Skip to content

Commit

Permalink
Merge pull request #187 from waveform80/test-skip-timing-on-pypy
Browse files Browse the repository at this point in the history
Disable timing tests on pypy
  • Loading branch information
waveform80 committed Feb 11, 2016
2 parents 2ea7107 + e8dbe5e commit 810bb67
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion tests/test_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
str = type('')


import sys
from time import sleep
try:
from math import isclose
except ImportError:
from gpiozero.compat import isclose

import pytest
from time import sleep

from gpiozero.pins.mock import MockPin, MockPWMPin
from gpiozero import *
Expand Down Expand Up @@ -85,6 +86,8 @@ def test_output_digital_toggle():
assert not device.value
assert not pin.state

@pytest.mark.skipif(hasattr(sys, 'pypy_version_info'),
reason='timing is too random on pypy')
def test_output_blink_background():
pin = MockPin(2)
device = DigitalOutputDevice(pin)
Expand All @@ -98,6 +101,8 @@ def test_output_blink_background():
(0.1, False)
])

@pytest.mark.skipif(hasattr(sys, 'pypy_version_info'),
reason='timing is too random on pypy')
def test_output_blink_foreground():
pin = MockPin(2)
device = DigitalOutputDevice(pin)
Expand Down Expand Up @@ -198,6 +203,8 @@ def test_output_pwm_write_silly():
with pytest.raises(AttributeError):
device.off()

@pytest.mark.skipif(hasattr(sys, 'pypy_version_info'),
reason='timing is too random on pypy')
def test_output_pwm_blink_background():
pin = MockPWMPin(2)
device = PWMOutputDevice(pin)
Expand All @@ -211,6 +218,8 @@ def test_output_pwm_blink_background():
(0.1, 0)
])

@pytest.mark.skipif(hasattr(sys, 'pypy_version_info'),
reason='timing is too random on pypy')
def test_output_pwm_blink_foreground():
pin = MockPWMPin(2)
device = PWMOutputDevice(pin)
Expand All @@ -223,6 +232,8 @@ def test_output_pwm_blink_foreground():
(0.1, 0)
])

@pytest.mark.skipif(hasattr(sys, 'pypy_version_info'),
reason='timing is too random on pypy')
def test_output_pwm_fade_background():
pin = MockPWMPin(2)
device = PWMOutputDevice(pin)
Expand Down Expand Up @@ -252,6 +263,8 @@ def test_output_pwm_fade_background():
(0.02, 0),
])

@pytest.mark.skipif(hasattr(sys, 'pypy_version_info'),
reason='timing is too random on pypy')
def test_output_pwm_fade_foreground():
pin = MockPWMPin(2)
device = PWMOutputDevice(pin)
Expand Down Expand Up @@ -326,6 +339,8 @@ def test_rgbled_toggle():
assert not device.is_active
assert device.value == (0, 0, 0)

@pytest.mark.skipif(hasattr(sys, 'pypy_version_info'),
reason='timing is too random on pypy')
def test_rgbled_blink_background():
r, g, b = (MockPWMPin(i) for i in (1, 2, 3))
device = RGBLED(r, g, b)
Expand All @@ -342,6 +357,8 @@ def test_rgbled_blink_background():
g.assert_states_and_times(expected)
b.assert_states_and_times(expected)

@pytest.mark.skipif(hasattr(sys, 'pypy_version_info'),
reason='timing is too random on pypy')
def test_rgbled_blink_foreground():
r, g, b = (MockPWMPin(i) for i in (1, 2, 3))
device = RGBLED(r, g, b)
Expand All @@ -357,6 +374,8 @@ def test_rgbled_blink_foreground():
g.assert_states_and_times(expected)
b.assert_states_and_times(expected)

@pytest.mark.skipif(hasattr(sys, 'pypy_version_info'),
reason='timing is too random on pypy')
def test_rgbled_fade_background():
r, g, b = (MockPWMPin(i) for i in (1, 2, 3))
device = RGBLED(r, g, b)
Expand Down

0 comments on commit 810bb67

Please sign in to comment.