@@ -22,7 +22,7 @@ def service(modules):
22
22
23
23
24
24
@pytest .fixture (scope = "function" , autouse = True )
25
- def service_name (service , service_name ):
25
+ def service_name (service ):
26
26
27
27
service_name = "com.salt.integration.test"
28
28
service_path = "/Library/LaunchDaemons/com.salt.integration.test.plist"
@@ -41,7 +41,11 @@ def service_name(service, service_name):
41
41
try :
42
42
yield service_name
43
43
finally :
44
- service .stop (service_name )
44
+ # Try to stop the service if it's running
45
+ try :
46
+ service .stop (service_name )
47
+ except CommandExecutionError :
48
+ pass
45
49
salt .utils .files .safe_rm (service_path )
46
50
47
51
@@ -52,7 +56,7 @@ def test_show(service, service_name):
52
56
# Existing Service
53
57
service_info = service .show (service_name )
54
58
assert isinstance (service_info , dict )
55
- assert service_info . data ["plist" ]["Label" ] == service_name
59
+ assert service_info ["plist" ]["Label" ] == service_name
56
60
57
61
# Missing Service
58
62
with pytest .raises (CommandExecutionError ) as exc :
@@ -228,7 +232,7 @@ def test_get_all(service, service_name):
228
232
"""
229
233
services = service .get_all ()
230
234
assert isinstance (services , list )
231
- assert service_name in services . data
235
+ assert service_name in services
232
236
233
237
234
238
def test_get_enabled (service , service_name ):
@@ -237,7 +241,7 @@ def test_get_enabled(service, service_name):
237
241
"""
238
242
services = service .get_enabled ()
239
243
assert isinstance (services , list )
240
- assert service_name in services . data
244
+ assert service_name in services
241
245
242
246
243
247
def test_service_laoded (service , service_name ):
0 commit comments