ttx tests: convert to skipped tests on Win using pytest skipif fixture
This commit is contained in:
parent
189e2487fe
commit
bb4753acd4
@ -787,15 +787,15 @@ def test_ttx_main_keyboard_interrupt(tmpdir, monkeypatch, capsys):
|
||||
assert "(Cancelled.)" in err
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.platform == "win32",
|
||||
reason="waitForKeyPress function causes test to hang on Windows platform")
|
||||
def test_ttx_main_system_exit(tmpdir, monkeypatch):
|
||||
# Exclude Windows testing. The exception handling here causes Windows platform tests to hang
|
||||
if sys.platform != "win32":
|
||||
with pytest.raises(SystemExit):
|
||||
inpath = os.path.join("Tests", "ttx", "data", "TestTTF.ttx")
|
||||
outpath = os.path.join(str(tmpdir), "TestTTF.ttf")
|
||||
args = ["-o", outpath, inpath]
|
||||
monkeypatch.setattr(ttx, 'process', (lambda x, y: raise_exception(SystemExit)))
|
||||
ttx.main(args)
|
||||
with pytest.raises(SystemExit):
|
||||
inpath = os.path.join("Tests", "ttx", "data", "TestTTF.ttx")
|
||||
outpath = os.path.join(str(tmpdir), "TestTTF.ttf")
|
||||
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):
|
||||
@ -810,18 +810,18 @@ def test_ttx_main_ttlib_error(tmpdir, monkeypatch, capsys):
|
||||
assert "Test error" in err
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.platform == "win32",
|
||||
reason="waitForKeyPress function causes test to hang on Windows platform")
|
||||
def test_ttx_main_base_exception(tmpdir, monkeypatch, capsys):
|
||||
# Exclude Windows testing. The exception handling here causes Windows platform tests to hang
|
||||
if sys.platform != "win32":
|
||||
with pytest.raises(SystemExit):
|
||||
inpath = os.path.join("Tests", "ttx", "data", "TestTTF.ttx")
|
||||
outpath = os.path.join(str(tmpdir), "TestTTF.ttf")
|
||||
args = ["-o", outpath, inpath]
|
||||
monkeypatch.setattr(ttx, 'process', (lambda x, y: raise_exception(Exception("Test error"))))
|
||||
ttx.main(args)
|
||||
with pytest.raises(SystemExit):
|
||||
inpath = os.path.join("Tests", "ttx", "data", "TestTTF.ttx")
|
||||
outpath = os.path.join(str(tmpdir), "TestTTF.ttf")
|
||||
args = ["-o", outpath, inpath]
|
||||
monkeypatch.setattr(ttx, 'process', (lambda x, y: raise_exception(Exception("Test error"))))
|
||||
ttx.main(args)
|
||||
|
||||
out, err = capsys.readouterr()
|
||||
assert "Unhandled exception has occurred" in err
|
||||
out, err = capsys.readouterr()
|
||||
assert "Unhandled exception has occurred" in err
|
||||
|
||||
# ---------------------------
|
||||
# support functions for tests
|
||||
|
Loading…
x
Reference in New Issue
Block a user