File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env python
22import unittest , sys , os
33
4+ FAKE_SYS = os .path .join (os .path .dirname (__file__ ), 'fake-sys' )
5+
6+ sys .path .append (FAKE_SYS )
47sys .path .append (os .path .join (os .path .dirname (__file__ ), '..' ))
58
9+ from populate_arena import populate_arena
10+ from clean_arena import clean_arena
11+
612import ev3dev .ev3 as ev3
713
8- ev3 .Device .DEVICE_ROOT_PATH = os .path .join (os . path . dirname ( __file__ ) , 'fake-sys ' )
14+ ev3 .Device .DEVICE_ROOT_PATH = os .path .join (FAKE_SYS , 'arena ' )
915
1016class TestAPI (unittest .TestCase ):
1117 def test_device (self ):
18+ clean_arena ()
19+ populate_arena ({'medium_motor' : [0 ], 'infrared_sensor' : [0 ]})
20+
1221 d = ev3 .Device ('tacho-motor' , 'motor*' )
1322 self .assertTrue (d .connected )
1423
@@ -31,6 +40,9 @@ def test_medium_motor(self):
3140 def dummy (self ):
3241 pass
3342
43+ clean_arena ()
44+ populate_arena ({'medium_motor' : [0 ]})
45+
3446 # Do not write motor.command on exit (so that fake tree stays intact)
3547 ev3 .MediumMotor .__del__ = dummy
3648
@@ -66,6 +78,9 @@ def dummy(self):
6678 c = m .command
6779
6880 def test_infrared_sensor (self ):
81+ clean_arena ()
82+ populate_arena ({'infrared_sensor' : [0 ]})
83+
6984 s = ev3 .InfraredSensor ()
7085
7186 self .assertTrue (s .connected )
You can’t perform that action at this time.
0 commit comments