File: test_smoke.py

package info (click to toggle)
python-pdoc 15.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,192 kB
  • sloc: python: 8,013; javascript: 1,156; makefile: 18; sh: 3
file content (31 lines) | stat: -rw-r--r-- 754 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
31
import importlib
import pkgutil

import pytest

import pdoc

# idlelib: starts IDLE, hard to avoid...
# test: runs too slow
# py: https://bugs.python.org/issue35791
modules = [
    m.name
    for m in pkgutil.iter_modules()
    if not m.name.startswith("_") and m.name not in ("test", "idlelib", "py", "six")
] + ["unittest.mock"]


@pytest.mark.slow
@pytest.mark.filterwarnings("ignore")
@pytest.mark.parametrize("module", modules)
def test_smoke(module):
    try:
        with pdoc.extract.mock_some_common_side_effects():
            importlib.import_module(module)
    except pdoc.extract.AnyException:
        pass
    else:
        try:
            pdoc.pdoc(module)
        except RuntimeError as e:
            assert "Error importing" in str(e)