ttx tests: exclude mocked exceptions on Windows platform testing
This commit is contained in:
parent
3e7b33c22f
commit
189e2487fe
@ -8,6 +8,7 @@ import getopt
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
@ -787,12 +788,14 @@ def test_ttx_main_keyboard_interrupt(tmpdir, monkeypatch, capsys):
|
|||||||
|
|
||||||
|
|
||||||
def test_ttx_main_system_exit(tmpdir, monkeypatch):
|
def test_ttx_main_system_exit(tmpdir, monkeypatch):
|
||||||
with pytest.raises(SystemExit):
|
# Exclude Windows testing. The exception handling here causes Windows platform tests to hang
|
||||||
inpath = os.path.join("Tests", "ttx", "data", "TestTTF.ttx")
|
if sys.platform != "win32":
|
||||||
outpath = os.path.join(str(tmpdir), "TestTTF.ttf")
|
with pytest.raises(SystemExit):
|
||||||
args = ["-o", outpath, inpath]
|
inpath = os.path.join("Tests", "ttx", "data", "TestTTF.ttx")
|
||||||
monkeypatch.setattr(ttx, 'process', (lambda x, y: raise_exception(SystemExit)))
|
outpath = os.path.join(str(tmpdir), "TestTTF.ttf")
|
||||||
ttx.main(args)
|
args = ["-o", outpath, inpath]
|
||||||
|
monkeypatch.setattr(ttx, 'process', (lambda x, y: raise_exception(SystemExit)))
|
||||||
|
ttx.main(args)
|
||||||
|
|
||||||
|
|
||||||
def test_ttx_main_ttlib_error(tmpdir, monkeypatch, capsys):
|
def test_ttx_main_ttlib_error(tmpdir, monkeypatch, capsys):
|
||||||
@ -808,15 +811,17 @@ def test_ttx_main_ttlib_error(tmpdir, monkeypatch, capsys):
|
|||||||
|
|
||||||
|
|
||||||
def test_ttx_main_base_exception(tmpdir, monkeypatch, capsys):
|
def test_ttx_main_base_exception(tmpdir, monkeypatch, capsys):
|
||||||
with pytest.raises(SystemExit):
|
# Exclude Windows testing. The exception handling here causes Windows platform tests to hang
|
||||||
inpath = os.path.join("Tests", "ttx", "data", "TestTTF.ttx")
|
if sys.platform != "win32":
|
||||||
outpath = os.path.join(str(tmpdir), "TestTTF.ttf")
|
with pytest.raises(SystemExit):
|
||||||
args = ["-o", outpath, inpath]
|
inpath = os.path.join("Tests", "ttx", "data", "TestTTF.ttx")
|
||||||
monkeypatch.setattr(ttx, 'process', (lambda x, y: raise_exception(Exception("Test error"))))
|
outpath = os.path.join(str(tmpdir), "TestTTF.ttf")
|
||||||
ttx.main(args)
|
args = ["-o", outpath, inpath]
|
||||||
|
monkeypatch.setattr(ttx, 'process', (lambda x, y: raise_exception(Exception("Test error"))))
|
||||||
|
ttx.main(args)
|
||||||
|
|
||||||
out, err = capsys.readouterr()
|
out, err = capsys.readouterr()
|
||||||
assert "Unhandled exception has occurred" in err
|
assert "Unhandled exception has occurred" in err
|
||||||
|
|
||||||
# ---------------------------
|
# ---------------------------
|
||||||
# support functions for tests
|
# support functions for tests
|
||||||
|
Loading…
x
Reference in New Issue
Block a user