Coverage for tests/test_themes.py: 100.00%

Shortcuts on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

10 statements  

1"""Tests for the different themes we claim to support.""" 

2 

3import sys 

4 

5import pytest 

6 

7 

8@pytest.mark.parametrize( 

9 "plugin", 

10 [ 

11 {"theme": "mkdocs"}, 

12 {"theme": "readthedocs"}, 

13 {"theme": {"name": "material"}}, 

14 ], 

15 indirect=["plugin"], 

16) 

17@pytest.mark.parametrize( 

18 "module", 

19 [ 

20 "mkdocstrings.extension", 

21 "mkdocstrings.inventory", 

22 "mkdocstrings.loggers", 

23 "mkdocstrings.plugin", 

24 "mkdocstrings.handlers.base", 

25 "mkdocstrings.handlers.rendering", 

26 "mkdocstrings_handlers.python.handler", 

27 "mkdocstrings_handlers.python.rendering", 

28 ], 

29) 

30@pytest.mark.skipif(sys.version_info < (3, 7), reason="material is not installed on Python 3.6") 

31def test_render_themes_templates(module, plugin): 

32 """Test rendering of a given theme's templates. 

33 

34 Parameters: 

35 module: The module to load and render (parametrized). 

36 plugin: The plugin instance (parametrized fixture). 

37 """ 

38 handler = plugin.handlers.get_handler("python") 

39 handler._update_env(plugin.md, plugin.handlers._config) # noqa: WPS437 

40 data = handler.collect(module, {}) 

41 handler.render(data, {})