File tree Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Original file line number Diff line number Diff line change 1+ #debian@beaglebone:~/adafruit-beaglebone-io-python/test$ cat test_adc.py
12import pytest
23import os
3-
4+ import platform
45import Adafruit_BBIO .ADC as ADC
56
7+
68def teardown_module (module ):
79 pass
810 #ADC.cleanup()
@@ -17,14 +19,20 @@ def test_read_raw_adc_no_setup(self):
1719 ADC .read_raw ("P9_40" )
1820
1921 def test_setup_adc (self ):
20- ADC .setup ()
2122
22- files = os .listdir ('/sys/devices' )
23- ocp = '/sys/devices/' + [s for s in files if s .startswith ('ocp' )][0 ]
24- files = os .listdir (ocp )
25- helper_path = ocp + '/' + [s for s in files if s .startswith ('helper' )][0 ]
23+ ADC .setup ()
2624
27- assert os .path .exists (helper_path + "/AIN1" )
25+ kernel = platform .release ()
26+ if kernel >= '4.1.0' :
27+ test_path = "/sys/bus/iio/devices/iio:device0/in_voltage1_raw"
28+ else :
29+ files = os .listdir ('/sys/devices' )
30+ ocp = '/sys/devices/' + [s for s in files if s .startswith ('ocp' )][0 ]
31+ files = os .listdir (ocp )
32+ helper_path = ocp + '/' + [s for s in files if s .startswith ('helper' )][0 ]
33+ test_path = helper_path + "/AIN1"
34+
35+ assert os .path .exists (test_path );
2836 #ADC.cleanup()
2937
3038 def test_read_adc (self ):
@@ -50,4 +58,4 @@ def test_many_read_adc(self):
5058 start = time .time ()
5159 value = - 1
5260 value = ADC .read ("AIN1" )
53- assert value != - 1
61+ assert value != - 1
You can’t perform that action at this time.
0 commit comments