[lang-ref] ( make_directory_with_parents ) ( python )

def test_make_directory_with_parents(pushd):
    # os.makedirs(path, exist_ok=True)
    os.makedirs('dir1/sub1/sub2', exist_ok=True)
    assert os.path.isdir('dir1/sub1/sub2')
def test_make_directory_with_parents_alternative(pushd):
    # pathlib.Path.mkdir(parents=True, exist_ok=True)
    Path('dir1/sub1/sub2').mkdir(parents=True, exist_ok=True)
    assert Path('dir1/sub1/sub2').is_dir()