File tree 2 files changed +21
-4
lines changed
2 files changed +21
-4
lines changed Original file line number Diff line number Diff line change
1
+ # content of conftest.py
2
+ import pytest
3
+
4
+
5
+ def pytest_addoption (parser ):
6
+ parser .addoption (
7
+ "--device" ,
8
+ action = "store" ,
9
+ default = None ,
10
+ help = 'Set the alsa device. Defaults to `None`.'
11
+ )
12
+
13
+
14
+ @pytest .fixture
15
+ def device (request ):
16
+ return request .config .getoption ('--device' )
Original file line number Diff line number Diff line change 3
3
from school_bell .school_bell import SchoolBell , _validate_day , _validate_time
4
4
5
5
6
- def create_args (holidays : str = None ):
6
+ def create_args (device ):
7
7
return {
8
8
'schedule' : {
9
9
'Wed' : {
@@ -16,6 +16,7 @@ def create_args(holidays: str = None):
16
16
'1' : 'SchoolBell-SoundBible.com-449398625.wav'
17
17
},
18
18
'root' : f"{ getcwd ()} /samples" ,
19
+ 'device' : device ,
19
20
'test' : True ,
20
21
'timeout' : 10 ,
21
22
'holidays' : 'NL-BE' ,
@@ -46,8 +47,8 @@ def test_validate_time():
46
47
assert _validate_time ("00:00:60" ) is False
47
48
48
49
49
- def test_school_bell ():
50
- bell = SchoolBell (** create_args ())
51
- assert bell .play (0 ) == True
50
+ def test_school_bell (device ):
51
+ bell = SchoolBell (** create_args (device ))
52
+ assert bell .play (0 ) is True
52
53
assert bell .ring (1 ) != bell .is_holiday ()
53
54
assert bell .run_schedule (_test_mode = True ) is True
You can’t perform that action at this time.
0 commit comments