Skip to content

Commit

Permalink
test --timing in test_main.py
Browse files Browse the repository at this point in the history
  • Loading branch information
anthrotype committed Jul 28, 2022
1 parent dce116d commit 840d482
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import logging
import platform
import re
import shutil
import subprocess
import sys
from textwrap import dedent

import fontTools.designspaceLib as designspaceLib
Expand Down Expand Up @@ -1018,3 +1021,33 @@ def test_main_designspace_v5_dont_interpolate_discrete_axis(data_dir, tmp_path):
)
assert (tmp_path / "MutatorSansCondensedVariable_Weight.ttf").exists()
assert (tmp_path / "MutatorSansExtendedVariable_Weight.ttf").exists()


def test_timing_logger(data_dir, tmp_path):
# check that --timing flag logs timing-related DEBUG messags even if the
# logging level (as set by --verbose flag) is higher
result = subprocess.run(
[
sys.executable,
"-m",
"fontmake",
"--timing",
"--verbose",
"CRITICAL",
"-m",
str(data_dir / "DesignspaceTest" / "DesignspaceTest.designspace"),
"-i",
"-o",
"ttf",
"--output-dir",
str(tmp_path),
],
capture_output=True,
check=True,
)

assert re.match(
r"^DEBUG:fontmake.timer:Took [\.0-9]+s to run 'save_otfs'$",
result.stderr.decode(),
flags=re.MULTILINE,
)

0 comments on commit 840d482

Please sign in to comment.