summaryrefslogtreecommitdiff
path: root/tests/test_theming.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_theming.py')
-rw-r--r--tests/test_theming.py27
1 files changed, 15 insertions, 12 deletions
diff --git a/tests/test_theming.py b/tests/test_theming.py
index b62cbcd72..ce207a519 100644
--- a/tests/test_theming.py
+++ b/tests/test_theming.py
@@ -13,14 +13,16 @@ import os
import zipfile
import mock
+import pytest
from sphinx.theming import Theme, ThemeError
-from util import with_app, raises, path
+from util import with_app, path
-@with_app(confoverrides={'html_theme': 'ziptheme',
- 'html_theme_options.testopt': 'foo'})
+@pytest.mark.sphinx(
+ confoverrides={'html_theme': 'ziptheme',
+ 'html_theme_options.testopt': 'foo'})
def test_theme_api(app, status, warning):
cfg = app.config
@@ -46,10 +48,12 @@ def test_theme_api(app, status, warning):
assert theme.get_confstr('options', 'nosidebar') == 'false'
# nonexisting setting
assert theme.get_confstr('theme', 'foobar', 'def') == 'def'
- raises(ThemeError, theme.get_confstr, 'theme', 'foobar')
+ with pytest.raises(ThemeError):
+ theme.get_confstr('theme', 'foobar')
# options API
- raises(ThemeError, theme.get_options, {'nonexisting': 'foo'})
+ with pytest.raises(ThemeError):
+ theme.get_options({'nonexisting': 'foo'})
options = theme.get_options(cfg.html_theme_options)
assert options['testopt'] == 'foo'
assert options['nosidebar'] == 'false'
@@ -59,7 +63,7 @@ def test_theme_api(app, status, warning):
assert not os.path.exists(themedir)
-@with_app(testroot='tocdepth') # a minimal root
+@pytest.mark.sphinx(testroot='tocdepth') # a minimal root
def test_js_source(app, status, warning):
# Now sphinx provides non-minified JS files for jquery.js and underscore.js
# to clarify the source of the minified files. see also #1434.
@@ -83,7 +87,8 @@ def test_js_source(app, status, warning):
assert 'Underscore.js {v}'.format(v=v) in underscore_src, msg
-def test_double_inheriting_theme():
+@pytest.mark.sphinx(testroot='double-inheriting-theme')
+def test_double_inheriting_theme(make_app, app_params):
from sphinx.theming import load_theme_plugins # load original before patching
def load_themes():
@@ -92,8 +97,6 @@ def test_double_inheriting_theme():
for t in load_theme_plugins():
yield t
- @mock.patch('sphinx.theming.load_theme_plugins', side_effect=load_themes)
- @with_app(testroot='double-inheriting-theme')
- def test_double_inheriting_theme_(app, status, warning, m_):
- pass
- yield test_double_inheriting_theme_
+ with mock.patch('sphinx.theming.load_theme_plugins', side_effect=load_themes):
+ args, kwargs = app_params
+ make_app(*args, **kwargs)