Fix tests

This commit is contained in:
Septatrix 2020-03-14 19:46:37 +01:00
parent 44fbd39ab2
commit f655835338
2 changed files with 7 additions and 7 deletions

View File

@ -1,4 +1,4 @@
[theme] [theme]
inherit = classic inherit = classic
sidebars = globaltoc.html, searchbox.html sidebars = globaltoc.html, searchbox.html
pygments_dark = monokai pygments_dark_style = monokai

View File

@ -11,8 +11,8 @@
import os import os
import alabaster import alabaster
import pytest
import pytest
from sphinx.theming import ThemeError from sphinx.theming import ThemeError
@ -119,7 +119,7 @@ def test_staticfiles(app, status, warning):
@pytest.mark.sphinx(testroot='theming', @pytest.mark.sphinx(testroot='theming',
confoverrides={'html_theme': 'test-theme'}) confoverrides={'html_theme': 'test-theme'})
def test_staticfiles(app, status, warning): def test_dark_style(app, status, warning):
style = app.builder.dark_highlighter.formatter_args.get('style') style = app.builder.dark_highlighter.formatter_args.get('style')
assert style.__name__ == 'MonokaiStyle' assert style.__name__ == 'MonokaiStyle'
@ -127,10 +127,10 @@ def test_staticfiles(app, status, warning):
assert (app.outdir / '_static' / 'pygments_dark.css').exists() assert (app.outdir / '_static' / 'pygments_dark.css').exists()
result = (app.outdir / 'index.html').read_text() result = (app.outdir / 'index.html').read_text()
assert '<link rel="stylesheet" href="_static/pygments.css" type="text/css">' in result assert '<link rel="stylesheet" href="_static/pygments.css" type="text/css" />' in result
assert ('<link rel="stylesheet" href="_static/pygments_dark.css"' assert ('<link id="pygments_dark_css" media="(prefers-color-scheme: dark)" '
'type="text/css" media="(prefers-color-scheme: dark)"' 'rel="stylesheet" type="text/css" '
'id="pygments_dark_css">') in result 'href="_static/pygments_dark.css" />') in result
@pytest.mark.sphinx(testroot='theming') @pytest.mark.sphinx(testroot='theming')