Exemple #1
0
def test_examples_cleanup_nodist(tempdir):
    tempdir = tempdir
    # put some crap in the temporary dir
    #
    # <tempdir>/
    #   idaes_examples.egg-info/
    #      afile
    #   <tempdir2>/
    #       afile
    #
    os.chdir(tempdir)
    eggy = Path("idaes_examples.egg-info")
    eggy.mkdir()
    (eggy / "afile").open("w")
    name2 = str(uuid.uuid4())
    tempsubdir = Path(name2)
    tempsubdir.mkdir()
    (tempsubdir / "afile").open("w")
    # All of the above should be removed
    # by the cleanup function.
    examples.g_tempdir = tempsubdir
    examples.g_egg = eggy
    examples.clean_up_temporary_files()
    # Check that everything is removed
    assert not eggy.exists()
    assert not tempsubdir.exists()
Exemple #2
0
def test_examples_cleanup(tempdir):
    # put some crap in the temporary dir
    #
    # <tempdir>/
    #   idaes_examples.egg-info/
    #      afile
    #   dist/
    #      idaes_examples-1.0.0-py3.8.egg
    #      idaes_examples-2.0.0-py3.9.egg
    #   <tempdir2>/
    #       afile
    #
    os.chdir(tempdir)
    eggy = Path("idaes_examples.egg-info")
    eggy.mkdir()
    (eggy / "afile").open("w")
    distdir = Path("dist")
    distdir.mkdir()
    (distdir / "idaes_examples-1.0.0-py3.8.egg").open("w")
    (distdir / "idaes_examples-2.0.0-py3.9.egg").open("w")
    name2 = str(uuid.uuid4())
    tempsubdir = Path(name2)
    tempsubdir.mkdir()
    (tempsubdir / "afile").open("w")
    # All of the above should be removed
    # by the cleanup function.
    examples.g_tempdir = tempsubdir
    examples.g_egg = eggy
    examples.clean_up_temporary_files()