Esempio n. 1
0
def test_find_html_docs(wspath):
    filedir = os.path.dirname(__file__)
    docpath = os.path.join(filedir, "..", "docs", "build", "html")
    commands.workspace_init(wspath, {}, html_paths=[docpath])
    dmfobj = dmfbase.DMF(wspath)
    filenames = commands.find_html_docs(dmfobj, dmfobj)
    assert len(filenames) > 0
Esempio n. 2
0
def tmp_dmf():
    """Test fixture to create a DMF in a temporary
    directory.
    """
    global scratchdir
    tmpdir = tempfile.mkdtemp()
    tmpdmf = dmfbase.DMF(path=tmpdir, create=True)
    scratchdir = os.path.join(tmpdir, 'scratch')
    os.mkdir(scratchdir)
    yield tmpdmf
    shutil.rmtree(tmpdir)
Esempio n. 3
0
def tmp_dmf():
    """Test fixture to create a DMF in a temporary
    directory.
    """
    tmpdir = mkdtemp()
    dmf = dmfbase.DMF(path=tmpdir, create=True)
    yield dmf
    removed = False
    for i in range(3):
        try:
            shutil.rmtree(tmpdir)
            removed = True
            print(f"@@ removed DMF temp dir on try {i+1}")
        except Exception as err:
            print(f"@@ error removing tempdir: {err}")
            time.sleep(1)
    print(f"@@ tries = {i + 1}")
    if not removed:
        warnings.warn(f"failed to remove temporary directory: {tmpdir}")