Skip to content

Commit 71f6760

Browse files
committed
fix: accept the favicon fallback in the logo test
favicon generation falls back to favicon.svg when cairosvg or its native cairo library isn't available, but the test only accepted favicon.ico or logo.svg, failing on machines without a working cairo install even though the generated site is correct.
1 parent 0a0cc83 commit 71f6760

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

‎tests/test_gdg_rendered.py‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2057,21 +2057,25 @@ def test_logo_replaces_title():
20572057
# Alt text should fall back to display_name
20582058
assert navbar.get("logo-alt") == "Logo Test", "logo-alt should be the display_name"
20592059

2060-
# Favicon should be auto-generated from logo.svg and referenced in config
2060+
# Favicon should be auto-generated from logo.svg and referenced in config.
2061+
# favicon.svg is the fallback when cairosvg or its native cairo library
2062+
# is unavailable; see great_docs.core.GreatDocs._generate_favicons.
20612063
favicon = cfg.get("website", {}).get("favicon")
2062-
assert favicon in ("favicon.ico", "logo.svg"), (
2063-
f"favicon should be favicon.ico or logo.svg, got {favicon}"
2064+
assert favicon in ("favicon.ico", "favicon.svg", "logo.svg"), (
2065+
f"favicon should be favicon.ico, favicon.svg, or logo.svg, got {favicon}"
20642066
)
20652067

20662068
# Logo files should exist in the build directory
20672069
build_dir = _RENDERED_DIR / pkg / "great-docs"
20682070
assert (build_dir / "logo.svg").exists(), "logo.svg should be copied to build dir"
20692071
assert (build_dir / "logo-dark.svg").exists(), "logo-dark.svg should be copied to build dir"
20702072

2071-
# Check for generated favicon files
2073+
# The SVG favicon is copied unconditionally; raster variants additionally
2074+
# require a working cairosvg installation.
2075+
assert (build_dir / "favicon.svg").exists(), "favicon.svg should exist"
2076+
20722077
if favicon == "favicon.ico":
20732078
assert (build_dir / "favicon.ico").exists(), "favicon.ico should exist"
2074-
assert (build_dir / "favicon.svg").exists(), "favicon.svg should exist"
20752079
assert (build_dir / "favicon-32x32.png").exists(), "favicon-32x32.png should exist"
20762080
assert (build_dir / "favicon-16x16.png").exists(), "favicon-16x16.png should exist"
20772081
assert (build_dir / "apple-touch-icon.png").exists(), "apple-touch-icon.png should exist"

0 commit comments

Comments
 (0)