Skip to content

Commit 5f00ad7

Browse files
committed
TST: Explicitly set Dejavu Sans font for testing
1 parent a53e629 commit 5f00ad7

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

plotnine/themes/theme.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222

2323
# All complete themes are initiated with these rcparams. They
2424
# can be overridden.
25-
default_rcparams = {
25+
DEFAULT_RCPARAMS = {
2626
"axes.axisbelow": "True",
2727
"font.sans-serif": [
28-
# "Helvetica",
28+
"Helvetica",
2929
"DejaVu Sans", # MPL ships with this one
3030
"Avant Garde",
3131
"Computer Modern Sans serif",
@@ -225,7 +225,7 @@ def __init__(
225225
self.complete = complete
226226

227227
if complete:
228-
self._rcParams = deepcopy(default_rcparams)
228+
self._rcParams = deepcopy(DEFAULT_RCPARAMS)
229229
else:
230230
self._rcParams = {}
231231

tests/conftest.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,16 @@
1111
from matplotlib.testing.compare import compare_images
1212

1313
from plotnine import ggplot, theme
14+
from plotnine.themes.theme import DEFAULT_RCPARAMS
1415

1516
TOLERANCE = 2 # Default tolerance for the tests
1617
DPI = 72 # Default DPI for the tests
1718

19+
# To get uniform test images, we use fonts that ship with matplotlib
20+
DEFAULT_RCPARAMS["font.monospace"] = ["Dejavu Sans Mono"]
21+
DEFAULT_RCPARAMS["font.sans-serif"] = ["Dejavu Sans"]
22+
DEFAULT_RCPARAMS["font.serif"] = ["Dejavu Serif"]
23+
1824
# This partial theme modifies all themes that are used in
1925
# the test. It is limited to setting the size of the test
2026
# images Should a test require a larger or smaller figure

0 commit comments

Comments
 (0)