Пример #1
0
def test_mkdir_p():
    random_str = hashlib.sha1().hexdigest()
    # test absolute
    path = "/tmp/{}/idaes/dmf/util/mkdir_p".format(random_str)
    util.mkdir_p(path)
    assert os.path.exists(path)
    shutil.rmtree("/tmp/{}".format(random_str))
    # test relative
    path = "{}/idaes/dmf/util/mkdir_p".format(random_str)
    util.mkdir_p(path)
    assert os.path.exists(path)
    shutil.rmtree(random_str)
Пример #2
0
def test_mkdir_p():
    tmp_dir = scratch_path / "mkdir_p"
    random_str = hashlib.sha1().hexdigest()
    # test absolute
    path = str(tmp_dir / f"{random_str}/idaes/dmf/util/mkdir_p")
    util.mkdir_p(path)
    assert os.path.exists(path)
    # test relative
    random_str = hashlib.sha1().hexdigest()
    os.chdir(str(tmp_dir))
    path = f"{random_str}/idaes/dmf/util/mkdir_p"
    util.mkdir_p(path)
    assert os.path.exists(path)