diff --git a/coverage/misc.py b/coverage/misc.py index 91ccd9644..11dad23e0 100644 --- a/coverage/misc.py +++ b/coverage/misc.py @@ -156,8 +156,8 @@ def ensure_dir(directory): If `directory` is None or empty, do nothing. """ - if directory and not os.path.isdir(directory): - os.makedirs(directory) + if directory: + os.makedirs(directory, exist_ok=True) def ensure_dir_for_file(path):