ttx_test: test dumping and compiling from stdin to stdout
This commit is contained in:
parent
15b450e4a6
commit
1d6326ea61
@ -6,9 +6,11 @@ import getopt
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
@ -996,6 +998,24 @@ def test_main_base_exception(tmpdir, monkeypatch, caplog):
|
||||
assert "Unhandled exception has occurred" in caplog.text
|
||||
|
||||
|
||||
def test_main_ttf_dump_stdin_to_stdout(tmp_path):
|
||||
inpath = Path("Tests").joinpath("ttx", "data", "TestTTF.ttf")
|
||||
outpath = tmp_path / "TestTTF.ttx"
|
||||
args = [sys.executable, "-m", "fontTools.ttx", "-q", "-o", "-", "-"]
|
||||
with inpath.open("rb") as infile, outpath.open("w", encoding="utf-8") as outfile:
|
||||
subprocess.run(args, check=True, stdin=infile, stdout=outfile)
|
||||
assert outpath.is_file()
|
||||
|
||||
|
||||
def test_main_ttx_compile_stdin_to_stdout(tmp_path):
|
||||
inpath = Path("Tests").joinpath("ttx", "data", "TestTTF.ttx")
|
||||
outpath = tmp_path / "TestTTF.ttf"
|
||||
args = [sys.executable, "-m", "fontTools.ttx", "-q", "-o", "-", "-"]
|
||||
with inpath.open("r", encoding="utf-8") as infile, outpath.open("wb") as outfile:
|
||||
subprocess.run(args, check=True, stdin=infile, stdout=outfile)
|
||||
assert outpath.is_file()
|
||||
|
||||
|
||||
# ---------------------------
|
||||
# support functions for tests
|
||||
# ---------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user