File: test_fixtures.py

package info (click to toggle)
python-autodoc-traits 1.2.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 212 kB
  • sloc: python: 408; makefile: 3
file content (30 lines) | stat: -rw-r--r-- 1,091 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import os


def test_temp_docs_dir(temp_docs_dir):
    """
    Verify that we get a reference to a temporary directory with source/conf.py
    in it.
    """
    assert os.path.isdir(os.path.join(temp_docs_dir, "source"))
    assert os.path.isfile(os.path.join(temp_docs_dir, "source/conf.py"))


def test_get_glob_filtered_temp_docs_dir(get_glob_filtered_temp_docs_dir):
    """
    Verify that we get a reference to a temporary directory with:
    - source/conf.py
    - index.rst files retained
    - filtered .rst files removed
    - non-filtered .rst files retained
    """
    temp_docs_dir = get_glob_filtered_temp_docs_dir(
        ["index.rst", "automodule/members.rst"]
    )
    assert os.path.isdir(os.path.join(temp_docs_dir, "source"))
    assert os.path.isfile(os.path.join(temp_docs_dir, "source/conf.py"))
    assert os.path.isfile(os.path.join(temp_docs_dir, "source/index.rst"))
    assert os.path.isfile(os.path.join(temp_docs_dir, "source/automodule/members.rst"))
    assert not os.path.isfile(
        os.path.join(temp_docs_dir, "source/autoclass/members.rst")
    )