Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5ce631c

Browse files
committed
DEBUG-log font-matching results, and print failing logs on CI.
pytest will only actually output logs if the test fail.
1 parent 5702999 commit 5ce631c

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

.appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ environment:
1515
global:
1616
PYTHONIOENCODING: UTF-8
1717
PYTEST_ARGS: -raR --numprocesses=auto --timeout=300 --durations=25
18-
--cov-report= --cov=lib -m "not network"
18+
--cov-report= --cov=lib -m "not network" --log-level=DEBUG
1919

2020
matrix:
2121
# theoretically the CONDA_INSTALL_LOCN could be only two: one for 32bit,

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ env:
7070
- NPROC=2
7171
- OPENBLAS_NUM_THREADS=1
7272
- PYTHONFAULTHANDLER=1
73-
- PYTEST_ADDOPTS="-raR --maxfail=50 --timeout=300 --durations=25 --cov-report= --cov=lib -n $NPROC"
73+
- PYTEST_ADDOPTS="-raR --maxfail=50 --timeout=300 --durations=25 --cov-report= --cov=lib -n $NPROC --log-level=DEBUG"
7474
- RUN_PYTEST=1
7575
- RUN_FLAKE8=
7676

azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141

4242
- script: |
4343
env
44-
pytest --junitxml=junit/test-results.xml -raR --maxfail=50 --timeout=300 --durations=25 --cov-report= --cov=lib -n 2
44+
pytest --junitxml=junit/test-results.xml -raR --maxfail=50 --timeout=300 --durations=25 --cov-report= --cov=lib -n 2 --log-level=DEBUG
4545
displayName: 'pytest'
4646
4747
- task: PublishTestResults@2

lib/matplotlib/font_manager.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,10 +1222,9 @@ def _findfont_cached(self, prop, fontext, directory, fallback_to_default,
12221222

12231223
if not isinstance(prop, FontProperties):
12241224
prop = FontProperties(prop)
1225-
fname = prop.get_file()
12261225

1226+
fname = prop.get_file()
12271227
if fname is not None:
1228-
_log.debug('findfont returning %s', fname)
12291228
return fname
12301229

12311230
if fontext == 'afm':
@@ -1236,19 +1235,19 @@ def _findfont_cached(self, prop, fontext, directory, fallback_to_default,
12361235
best_score = 1e64
12371236
best_font = None
12381237

1238+
_log.debug('findfont: Matching %s.', prop)
12391239
for font in fontlist:
12401240
if (directory is not None and
12411241
Path(directory) not in Path(font.fname).parents):
12421242
continue
1243-
# Matching family should have highest priority, so it is multiplied
1244-
# by 10.0
1245-
score = \
1246-
self.score_family(prop.get_family(), font.name) * 10.0 + \
1247-
self.score_style(prop.get_style(), font.style) + \
1248-
self.score_variant(prop.get_variant(), font.variant) + \
1249-
self.score_weight(prop.get_weight(), font.weight) + \
1250-
self.score_stretch(prop.get_stretch(), font.stretch) + \
1251-
self.score_size(prop.get_size(), font.size)
1243+
# Matching family should have top priority, so multiply it by 10.
1244+
score = (self.score_family(prop.get_family(), font.name) * 10
1245+
+ self.score_style(prop.get_style(), font.style)
1246+
+ self.score_variant(prop.get_variant(), font.variant)
1247+
+ self.score_weight(prop.get_weight(), font.weight)
1248+
+ self.score_stretch(prop.get_stretch(), font.stretch)
1249+
+ self.score_size(prop.get_size(), font.size))
1250+
_log.debug('findfont: score(%s) = %s', font, score)
12521251
if score < best_score:
12531252
best_score = score
12541253
best_font = font

lib/matplotlib/tests/test_animation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ def test_movie_writer_registry():
215215
reason="animation writer not installed")
216216
@pytest.mark.parametrize("method_name", ["to_html5_video", "to_jshtml"])
217217
def test_embed_limit(method_name, caplog, tmpdir):
218+
caplog.set_level("WARNING")
218219
with tmpdir.as_cwd():
219220
with mpl.rc_context({"animation.embed_limit": 1e-6}): # ~1 byte.
220221
getattr(make_animation(frames=1), method_name)()

0 commit comments

Comments
 (0)