File: test_docstrings.py

package info (click to toggle)
mdtraj 1.11.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 79,324 kB
  • sloc: python: 25,216; ansic: 6,266; cpp: 5,685; xml: 1,252; makefile: 192
file content (40 lines) | stat: -rw-r--r-- 1,002 bytes parent folder | download | duplicates (2)
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
31
32
33
34
35
36
37
38
39
40
import re

import pytest

import mdtraj
from mdtraj.testing.docstrings import docstring_verifiers, import_all_modules

SKIP_MODULES = [
    r"mdtraj\.utils\.external",
    r"mdtraj\.utils\.six",
    r"mdtraj\.utils\.unit\.unit_math",
    r"mdtraj\.utils\.unit\.baseunit",
    r"mdtraj\.utils\.unit\.prefix",
    r"mdtraj\.utils\.unit\.unit",
    r"mdtraj\.utils\.unit\.quantity",
    r"mdtraj\.utils\.unit\.mymatrix",
    r"mdtraj\.formats\.lh5",
    r"mdtraj\.formats\.hdf5",
    r"mdtraj\.formats\.pdb\.pdbstructure",
    r"mdtraj\.scripts",
    r"mdtraj\.testing\.docscrape",
    r"mdtraj\.io",
    r"mdtraj\._version",
]

MODULES = import_all_modules(mdtraj)


@pytest.fixture(params=MODULES, ids=lambda x: x.__name__)
def module(request):
    mod = request.param
    if any(re.search(s, mod.__name__) for s in SKIP_MODULES):
        pytest.skip("Skip checking certain modules' docstrings")

    return mod


def test_docstrings(module):
    for test in docstring_verifiers(module):
        test()