@@ -19,7 +19,7 @@ def pytest_configure(config):
19
19
raise Exception ("Failed to ping docker server." )
20
20
21
21
# validate selinux availability
22
- if sys .platform == ' linux' and os .path .isfile ("/etc/selinux/config" ):
22
+ if sys .platform == " linux" and os .path .isfile ("/etc/selinux/config" ):
23
23
try :
24
24
import selinux # noqa
25
25
except Exception :
@@ -29,7 +29,8 @@ def pytest_configure(config):
29
29
"libselinux python bindings installed. These can only be "
30
30
"installed using your distro package manager and are specific "
31
31
"to each python version. Common package names: "
32
- "libselinux-python python2-libselinux python3-libselinux" )
32
+ "libselinux-python python2-libselinux python3-libselinux"
33
+ )
33
34
# we do not re-raise this exception because missing or broken
34
35
# selinux bindings are not guaranteed to fail molecule execution.
35
36
@@ -41,7 +42,7 @@ def pytest_collect_file(parent, path):
41
42
42
43
class MoleculeFile (pytest .File ):
43
44
def collect (self ):
44
- yield MoleculeItem (' test' , self )
45
+ yield MoleculeItem (" test" , self )
45
46
46
47
def __str__ (self ):
47
48
return str (self .fspath .relto (os .getcwd ()))
@@ -53,11 +54,11 @@ def __init__(self, name, parent):
53
54
54
55
def runtest (self ):
55
56
folders = self .fspath .dirname .split (os .sep )
56
- cwd = os .path .abspath (os .path .join (self .fspath .dirname , ' ../..' ))
57
+ cwd = os .path .abspath (os .path .join (self .fspath .dirname , " ../.." ))
57
58
scenario = folders [- 1 ]
58
59
role = folders [- 3 ] # noqa
59
- cmd = [sys .executable , '-m' , ' molecule' , self .name , '-s' , scenario ]
60
- print ("running: %s (from %s)" % (" " .join (cmd ), cwd ))
60
+ cmd = [sys .executable , "-m" , " molecule" , self .name , "-s" , scenario ]
61
+ print ("running: %s (from %s)" % (" " .join (cmd ), cwd ))
61
62
62
63
try :
63
64
# Workaround for STDOUT/STDERR line ordering issue:
@@ -67,19 +68,20 @@ def runtest(self):
67
68
cwd = cwd ,
68
69
stdout = subprocess .PIPE ,
69
70
stderr = subprocess .STDOUT ,
70
- universal_newlines = True )
71
+ universal_newlines = True ,
72
+ )
71
73
for line in p .stdout :
72
74
print (line , end = "" )
73
75
p .wait ()
74
76
if p .returncode != 0 :
75
77
pytest .fail (
76
- "Error code %s returned by: %s" % (
77
- p . returncode , " " . join ( cmd )) ,
78
- pytrace = False )
78
+ "Error code %s returned by: %s" % (p . returncode , " " . join ( cmd )),
79
+ pytrace = False ,
80
+ )
79
81
except Exception as e :
80
82
pytest .fail (
81
- "Exception %s returned by: %s" % (e , " " .join (cmd )),
82
- pytrace = False )
83
+ "Exception %s returned by: %s" % (e , " " .join (cmd )), pytrace = False
84
+ )
83
85
84
86
def reportinfo (self ):
85
87
return self .fspath , 0 , "usecase: %s" % self .name
0 commit comments