check if dir exists before del in fixture
This commit is contained in:
parent
15363b924a
commit
bbc2ba0790
1 changed files with 3 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import json
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
|
|
@ -30,7 +31,8 @@ def working_directory() -> str:
|
|||
def _assert_working_directory_empty(self, is_error: bool = False):
|
||||
files = [str(file_path) for file_path in _get_files_in_directory(temp_dir)]
|
||||
num_files = len(files)
|
||||
shutil.rmtree(temp_dir)
|
||||
if os.path.isdir(temp_dir):
|
||||
shutil.rmtree(temp_dir)
|
||||
|
||||
if not is_error:
|
||||
if num_files > 0:
|
||||
|
|
|
|||
Loading…
Reference in a new issue