Skip to content

Commit ae42cd0

Browse files
committed
Base tests
1 parent 013b85d commit ae42cd0

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tests/test_base.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# -*- coding: future-fstrings -*-
2+
import pkgutil
3+
from functools import partial
4+
from importlib import import_module
5+
6+
from sphinx.testing.fixtures import make_app, test_params
7+
from sphinx.testing.path import path as STP
8+
9+
import scanpydoc
10+
11+
12+
def test_all_get_installed(monkeypatch, make_app, tmp_path):
13+
setups_seen = set()
14+
setups_called = {}
15+
for finder, mod_name, _ in pkgutil.walk_packages(
16+
scanpydoc.__path__, f"{scanpydoc.__name__}."
17+
):
18+
mod = import_module(mod_name)
19+
setups_seen.add(mod_name)
20+
monkeypatch.setattr(mod, "setup", partial(setups_called.__setitem__, mod_name))
21+
22+
(tmp_path / "conf.py").write_text("")
23+
app = make_app(srcdir=STP(tmp_path))
24+
scanpydoc.setup(app)
25+
26+
assert setups_called.keys() == setups_seen
27+
for mod_name, app2 in setups_called.items():
28+
assert app is app2

0 commit comments

Comments
 (0)