File tree Expand file tree Collapse file tree 2 files changed +34
-10
lines changed
Expand file tree Collapse file tree 2 files changed +34
-10
lines changed Original file line number Diff line number Diff line change 11import pytest
22import os
3+ import platform
34
45import Adafruit_BBIO .GPIO as GPIO
56
7+ kernel = platform .release ()
8+
9+
610def teardown_module (module ):
711 GPIO .cleanup ()
812
13+
914class TestSetup :
1015 def test_setup_output_key (self ):
1116 GPIO .setup ("P8_10" , GPIO .OUT )
@@ -53,7 +58,10 @@ def test_setup_cleanup(self):
5358 GPIO .setup ("P8_10" , GPIO .OUT )
5459 assert os .path .exists ('/sys/class/gpio/gpio68' )
5560 GPIO .cleanup ()
56- assert not os .path .exists ('/sys/class/gpio/gpio68' )
61+ if kernel < '4.1.0' :
62+ assert not os .path .exists ('/sys/class/gpio/gpio68' )
63+ # for later kernels, the universal capemanager always loads the
64+ # UARTs.
5765
5866 def test_setup_failed_type_error (self ):
5967 with pytest .raises (TypeError ):
@@ -69,4 +77,7 @@ def test_setup_three_digit_gpio(self):
6977 GPIO .setup ("P9_31" , GPIO .OUT )
7078 assert os .path .exists ('/sys/class/gpio/gpio110' )
7179 GPIO .cleanup ()
72- assert not os .path .exists ('/sys/class/gpio/gpio110' )
80+ if kernel < '4.1.0' :
81+ assert not os .path .exists ('/sys/class/gpio/gpio110' )
82+ # for later kernels, the universal capemanager always loads the
83+ # UARTs.
Original file line number Diff line number Diff line change 11import pytest
2- import os
2+ import platform
33
44import Adafruit_BBIO .UART as UART
55
6+ kernel = platform .release ()
7+
8+
69def teardown_module (module ):
710 pass
8- #ADC.cleanup()
11+ # ADC.cleanup()
12+
913
10- class TestAdc :
14+ class TestAdc :
1115 def test_setup_uart_wrong_name (self ):
12- with pytest .raises (ValueError ):
13- UART .setup ("UART7" )
16+ if kernel >= '4.1.0' :
17+ pass
18+ else :
19+ with pytest .raises (ValueError ):
20+ UART .setup ("UART7" )
1421
1522 def test_setup_adc (self ):
16- UART .setup ("UART1" )
23+ if kernel >= '4.1.0' :
24+ pass
25+ else :
26+ UART .setup ("UART1" )
1727
1828 def test_setup_adc_multiple (self ):
19- UART .setup ("UART1" )
20- UART .setup ("UART1" )
29+ if kernel >= '4.1.0' :
30+ pass
31+ else :
32+ UART .setup ("UART1" )
33+ UART .setup ("UART1" )
You can’t perform that action at this time.
0 commit comments