33
33
from plotnine .data import mtcars
34
34
35
35
LT_MPL310 = version .parse (mpl .__version__ ) < version .parse ("3.10" )
36
+ IS_CI = bool (os .environ .get ("CI" ))
36
37
37
38
38
39
def test_add_complete_complete ():
@@ -254,6 +255,7 @@ def test_theme_void():
254
255
assert p == "theme_void"
255
256
256
257
258
+ @pytest .mark .skipif (IS_CI , reason = "Don't run on CI (Github Actions)" )
257
259
@pytest .mark .skipif (LT_MPL310 , reason = "Fails for older versions of matplotlib" )
258
260
def test_theme_xkcd ():
259
261
p = (
@@ -264,12 +266,21 @@ def test_theme_xkcd():
264
266
+ theme (text = element_text (family = ["Comic Sans MS" ]))
265
267
)
266
268
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"
273
284
274
285
275
286
def test_override_axis_text ():
0 commit comments