def test_ensure_dir_exists_shallow_orphan(tmpdir): target_parent = tmpdir.mkdir("parent") target_dir = os.path.join(str(target_parent), "target") target_file = os.path.join(target_dir, "file") assert not os.path.exists(target_dir) io_handling._ensure_dir_exists(target_file) assert os.path.isdir(target_dir)
def test_ensure_dir_exists_current_directory(patch_makedirs): io_handling._ensure_dir_exists("filename") assert not patch_makedirs.called
def test_ensure_dir_exists_already_exists(tmpdir): target_dir = tmpdir.mkdir("target") io_handling._ensure_dir_exists(str(target_dir))