7
7
import sphinx .errors
8
8
from pydata_sphinx_theme .utils import escape_ansi
9
9
10
+ COMMON_CONF_OVERRIDES = dict (
11
+ navigation_with_keys = False ,
12
+ surface_warnings = True ,
13
+ )
14
+
10
15
11
16
def test_build_html (sphinx_build_factory , file_regression ) -> None :
12
17
"""Test building the base html template and config."""
@@ -238,7 +243,7 @@ def test_logo_missing_image(sphinx_build_factory) -> None:
238
243
# Test with a specified title and a dark logo
239
244
confoverrides = {
240
245
"html_theme_options" : {
241
- "navigation_with_keys" : False ,
246
+ ** COMMON_CONF_OVERRIDES ,
242
247
"logo" : {
243
248
# The logo is actually in _static
244
249
"image_dark" : "emptydarklogo.png" ,
@@ -753,7 +758,7 @@ def test_version_switcher_error_states(
753
758
"""
754
759
confoverrides = {
755
760
"html_theme_options" : {
756
- "navigation_with_keys" : False ,
761
+ ** COMMON_CONF_OVERRIDES ,
757
762
"navbar_end" : ["version-switcher" ],
758
763
"switcher" : {
759
764
"json_url" : url ,
@@ -778,7 +783,10 @@ def test_version_switcher_error_states(
778
783
assert not_read in escape_ansi (sphinx_build .warnings ).strip ()
779
784
780
785
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
+ )
782
790
assert escape_ansi (sphinx_build .warnings ).strip () == missing_url
783
791
784
792
@@ -814,14 +822,15 @@ def test_math_header_item(sphinx_build_factory, file_regression) -> None:
814
822
815
823
816
824
@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 (
821
829
("a11y-high-contrast-light" , "a11y-high-contrast-dark" ),
822
830
("#7928a1" , "#dcc6e0" ),
831
+ id = "real" ,
823
832
),
824
- ] ,
833
+ ) ,
825
834
)
826
835
def test_pygments_fallbacks (sphinx_build_factory , style_names , keyword_colors ) -> None :
827
836
"""Test that setting color themes works.
@@ -831,7 +840,7 @@ def test_pygments_fallbacks(sphinx_build_factory, style_names, keyword_colors) -
831
840
"""
832
841
confoverrides = {
833
842
"html_theme_options" : {
834
- "navigation_with_keys" : False ,
843
+ ** COMMON_CONF_OVERRIDES ,
835
844
"pygment_light_style" : style_names [0 ],
836
845
"pygment_dark_style" : style_names [1 ],
837
846
},
0 commit comments