Skip to content

Commit

Permalink
Fix up SPI tests
Browse files Browse the repository at this point in the history
The code to patch revision detection in concert with the API changes
breaks those tests; trivial fix
  • Loading branch information
waveform80 committed Jan 23, 2019
1 parent f98e568 commit c9ff335
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/test_spi.py
Expand Up @@ -8,6 +8,7 @@
str = type('')


import io
import sys
import pytest
from array import array
Expand All @@ -32,7 +33,7 @@ def teardown_function(function):
def test_spi_hardware_params():
with patch('os.open'), patch('mmap.mmap') as mmap_mmap, patch('io.open') as io_open:
mmap_mmap.return_value = array(nstr('B'), (0,) * 4096)
io_open.return_value.__enter__.return_value = ['Revision: a21042']
io_open.return_value.__enter__.return_value = io.BytesIO(b'\x00\xa2\x10\x42')
factory = NativeFactory()
with patch('gpiozero.pins.local.SpiDev'):
with factory.spi() as device:
Expand Down Expand Up @@ -63,7 +64,7 @@ def test_spi_hardware_params():
def test_spi_software_params():
with patch('os.open'), patch('mmap.mmap') as mmap_mmap, patch('io.open') as io_open:
mmap_mmap.return_value = array(nstr('B'), (0,) * 4096)
io_open.return_value.__enter__.return_value = ['Revision: a21042']
io_open.return_value.__enter__.return_value = io.BytesIO(b'\x00\xa2\x10\x42')
factory = NativeFactory()
with patch('gpiozero.pins.local.SpiDev'):
with factory.spi(select_pin=6) as device:
Expand Down

0 comments on commit c9ff335

Please sign in to comment.