Skip to content

Commit 218c664

Browse files
committed
fix tests
1 parent 82b061a commit 218c664

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed

tests/sites/deprecated/conf.py

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
# Base options, we can add other key/vals later
2323
html_theme_options = {
2424
"search_bar_position": "navbar",
25+
"surface_warnings": True,
2526
"logo_text": "DOCS",
2627
"footer_items": ["page-toc.html"],
2728
"favicons": [

tests/test_a11y.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,6 @@ def test_version_switcher_highlighting(page: Page, url_base: str) -> None:
135135
assert entries.count() == 2
136136
# make sure they're highlighted
137137
for entry in entries.all():
138-
light_mode = "rgb(39, 107, 233)"
139-
# dark_mode = "rgb(121, 163, 142)"
138+
light_mode = "rgb(10, 125, 145)" # pst-color-primary
139+
# dark_mode = "rgb(63, 177, 197)"
140140
expect(entry).to_have_css("color", light_mode)

tests/test_build.py

+18-9
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
import sphinx.errors
88
from pydata_sphinx_theme.utils import escape_ansi
99

10+
COMMON_CONF_OVERRIDES = dict(
11+
navigation_with_keys=False,
12+
surface_warnings=True,
13+
)
14+
1015

1116
def test_build_html(sphinx_build_factory, file_regression) -> None:
1217
"""Test building the base html template and config."""
@@ -238,7 +243,7 @@ def test_logo_missing_image(sphinx_build_factory) -> None:
238243
# Test with a specified title and a dark logo
239244
confoverrides = {
240245
"html_theme_options": {
241-
"navigation_with_keys": False,
246+
**COMMON_CONF_OVERRIDES,
242247
"logo": {
243248
# The logo is actually in _static
244249
"image_dark": "emptydarklogo.png",
@@ -753,7 +758,7 @@ def test_version_switcher_error_states(
753758
"""
754759
confoverrides = {
755760
"html_theme_options": {
756-
"navigation_with_keys": False,
761+
**COMMON_CONF_OVERRIDES,
757762
"navbar_end": ["version-switcher"],
758763
"switcher": {
759764
"json_url": url,
@@ -778,7 +783,10 @@ def test_version_switcher_error_states(
778783
assert not_read in escape_ansi(sphinx_build.warnings).strip()
779784

780785
elif url == "missing_url.json": # this file is missing the url key for one version
781-
missing_url = 'WARNING: The version switcher "missing_url.json" file is malformed at least one of the items is missing the "url" or "version" key'
786+
missing_url = (
787+
'WARNING: The version switcher "missing_url.json" file is malformed; '
788+
'at least one of the items is missing the "url" or "version" key'
789+
)
782790
assert escape_ansi(sphinx_build.warnings).strip() == missing_url
783791

784792

@@ -814,14 +822,15 @@ def test_math_header_item(sphinx_build_factory, file_regression) -> None:
814822

815823

816824
@pytest.mark.parametrize(
817-
"style_names,keyword_colors",
818-
[
819-
(("fake_foo", "fake_bar"), ("#204a87", "#66d9ef")),
820-
(
825+
("style_names", "keyword_colors"),
826+
(
827+
pytest.param(("fake_foo", "fake_bar"), ("#204a87", "#66d9ef"), id="fake"),
828+
pytest.param(
821829
("a11y-high-contrast-light", "a11y-high-contrast-dark"),
822830
("#7928a1", "#dcc6e0"),
831+
id="real",
823832
),
824-
],
833+
),
825834
)
826835
def test_pygments_fallbacks(sphinx_build_factory, style_names, keyword_colors) -> None:
827836
"""Test that setting color themes works.
@@ -831,7 +840,7 @@ def test_pygments_fallbacks(sphinx_build_factory, style_names, keyword_colors) -
831840
"""
832841
confoverrides = {
833842
"html_theme_options": {
834-
"navigation_with_keys": False,
843+
**COMMON_CONF_OVERRIDES,
835844
"pygment_light_style": style_names[0],
836845
"pygment_dark_style": style_names[1],
837846
},

0 commit comments

Comments
 (0)