Skip to content

Commit 443d904

Browse files
committed
TST: Use separate test for theme_xkcd on CI
1 parent 2cdc487 commit 443d904

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed
Loading

tests/test_theme.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
from plotnine.data import mtcars
3434

3535
LT_MPL310 = version.parse(mpl.__version__) < version.parse("3.10")
36+
IS_CI = bool(os.environ.get("CI"))
3637

3738

3839
def test_add_complete_complete():
@@ -254,6 +255,7 @@ def test_theme_void():
254255
assert p == "theme_void"
255256

256257

258+
@pytest.mark.skipif(IS_CI, reason="Don't run on CI (Github Actions)")
257259
@pytest.mark.skipif(LT_MPL310, reason="Fails for older versions of matplotlib")
258260
def test_theme_xkcd():
259261
p = (
@@ -264,12 +266,21 @@ def test_theme_xkcd():
264266
+ theme(text=element_text(family=["Comic Sans MS"]))
265267
)
266268

267-
if os.environ.get("CI") or os.environ.get("TRAVIS"):
268-
# Github Actions and Travis do not have the fonts,
269-
# we still check to catch any other errors
270-
assert p != "theme_gray"
271-
else:
272-
assert p == "theme_xkcd"
269+
assert p == "theme_xkcd"
270+
271+
272+
@pytest.mark.skipif(not IS_CI, reason="Only runs on CI (Github Actions)")
273+
@pytest.mark.skipif(LT_MPL310, reason="Fails for older versions of matplotlib")
274+
def test_theme_xkcd_ci():
275+
p = (
276+
g
277+
+ labs(title="Theme XKCD")
278+
+ theme_xkcd()
279+
# MPL ships with DejaVu Sans
280+
+ theme(text=element_text(family=["DejaVu Sans"]))
281+
)
282+
283+
assert p == "theme_xkcd_ci"
273284

274285

275286
def test_override_axis_text():

0 commit comments

Comments
 (0)