File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
allure-python-commons/src Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change 1+ import errno
12import io
23import os
34import sys
@@ -16,13 +17,16 @@ class AllureFileLogger(object):
1617 def __init__ (self , report_dir , clean = False ):
1718 self ._report_dir = report_dir
1819
19- if not os . path . exists ( report_dir ) :
20+ try :
2021 os .makedirs (report_dir )
21- elif clean :
22- for f in os .listdir (report_dir ):
23- f = os .path .join (report_dir , f )
24- if os .path .isfile (f ):
25- os .unlink (f )
22+ except OSError as e :
23+ if e .errno != errno .EEXIST :
24+ raise
25+ elif clean :
26+ for f in os .listdir (report_dir ):
27+ f = os .path .join (report_dir , f )
28+ if os .path .isfile (f ):
29+ os .unlink (f )
2630
2731 def _report_item (self , item ):
2832 indent = INDENT if os .environ .get ("ALLURE_INDENT_OUTPUT" ) else None
You can’t perform that action at this time.
0 commit comments