<commit_before>import tempfile
import os
from sequana.sphinxext import snakemakerule
from sphinx.application import Sphinx

def test_doc():
    res  = snakemakerule.get_rule_doc("dag")
    res  = snakemakerule.get_rule_doc("fastqc")

    try:
        res  = snakemakerule.get_rule_doc("dummy")
        assert False
    except FileNotFoundError:
        assert True
    except:
        assert False

    with tempfile.TemporaryDirectory() as tmpdir:

        # Create the conf and index in tmpdir
        with open(tmpdir+os.sep+"index.rst", "w") as fh:
            fh.write(".. snakemakerule:: dag\n")

        with open(tmpdir+os.sep+"conf.py", "w") as fh:
            print(fh.name)
            fh.write("""
import sys, os
import sphinx
sys.path.insert(0, os.path.abspath('sphinxext'))
extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.doctest',
    "sequana.sphinxext.snakemakerule"
    ]
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = "sequana"
copyright = "2016"
version = '1.0' 
release = "1.0"
exclude_patterns = []
add_module_names = False
pygments_style = 'sphinx'
intersphinx_mapping = {}
""")

        # srcdir, confdir, outdir, doctreedir, buildername
        app = Sphinx(tmpdir, tmpdir, tmpdir, tmpdir, "html")
        app.build()
<commit_msg>fix test<commit_after>import tempfile
import os
from sequana.sphinxext import snakemakerule
from sphinx.application import Sphinx

def test_doc():
    res  = snakemakerule.get_rule_doc("dag")
    res  = snakemakerule.get_rule_doc("fastqc_dynamic")

    try:
        res  = snakemakerule.get_rule_doc("dummy")
        assert False
    except FileNotFoundError:
        assert True
    except:
        assert False

    with tempfile.TemporaryDirectory() as tmpdir:

        # Create the conf and index in tmpdir
        with open(tmpdir+os.sep+"index.rst", "w") as fh:
            fh.write(".. snakemakerule:: dag\n")

        with open(tmpdir+os.sep+"conf.py", "w") as fh:
            print(fh.name)
            fh.write("""
import sys, os
import sphinx
sys.path.insert(0, os.path.abspath('sphinxext'))
extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.doctest',
    "sequana.sphinxext.snakemakerule"
    ]
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = "sequana"
copyright = "2016"
version = '1.0' 
release = "1.0"
exclude_patterns = []
add_module_names = False
pygments_style = 'sphinx'
intersphinx_mapping = {}
""")

        # srcdir, confdir, outdir, doctreedir, buildername
        app = Sphinx(tmpdir, tmpdir, tmpdir, tmpdir, "html")
        app.build()

{'fraction_non_alphanumeric': 0.1241855116903028, 'fraction_numerical': 0.006899195093905711, 'mean_word_length': 3.090909090909091, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6417086', 'n_tokens_mistral': 954, 'n_tokens_neox': 899, 'n_words': 199}