File tree 1 file changed +4
-6
lines changed 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -223,8 +223,7 @@ def create_asset(
223
223
os .path .dirname (self .logfile ), "assets" , asset_file_name
224
224
)
225
225
226
- if not os .path .exists (os .path .dirname (asset_path )):
227
- os .makedirs (os .path .dirname (asset_path ))
226
+ os .makedirs (os .path .dirname (asset_path ), exist_ok = True )
228
227
229
228
relative_path = f"assets/{ asset_file_name } "
230
229
@@ -615,10 +614,9 @@ def _save_report(self, report_content):
615
614
dir_name = os .path .dirname (self .logfile )
616
615
assets_dir = os .path .join (dir_name , "assets" )
617
616
618
- if not os .path .exists (dir_name ):
619
- os .makedirs (dir_name )
620
- if not self .self_contained and not os .path .exists (assets_dir ):
621
- os .makedirs (assets_dir )
617
+ os .makedirs (dir_name , exist_ok = True )
618
+ if not self .self_contained :
619
+ os .makedirs (assets_dir , exist_ok = True )
622
620
623
621
with open (self .logfile , "w" , encoding = "utf-8" ) as f :
624
622
f .write (report_content )
You can’t perform that action at this time.
0 commit comments