Use pytest for Python bindings test suite

This commit is contained in:
John J. Camilleri
2021-08-30 13:31:27 +02:00
parent 239fd02249
commit 3e4f2ba1a0
3 changed files with 68 additions and 68 deletions

View File

@@ -0,0 +1,65 @@
import pytest
import pgf
# readPGF
@pytest.fixture(scope="module")
def PGF():
return pgf.readPGF("../haskell/tests/basic.pgf")
def test_readPGF_non_existant():
with pytest.raises(FileNotFoundError):
pgf.readPGF("../haskell/tests/abc.pgf")
def test_readPGF_GF():
with pytest.raises(pgf.PGFError):
pgf.readPGF("../haskell/tests/basic.gf")
@pytest.mark.skip(reason="Bug in runtime")
def test_readPGF_NGF(NGF):
with pytest.raises(pgf.PGFError):
pgf.readPGF("./basic.ngf")
# bootNGF
@pytest.fixture(scope="module")
def NGF():
return pgf.bootNGF("../haskell/tests/basic.pgf", "./basic.ngf")
def test_bootNGF_non_existant():
with pytest.raises(FileNotFoundError):
pgf.bootNGF("../haskell/tests/abc.pgf", "./abc.ngf")
def test_bootNGF_GF():
with pytest.raises(pgf.PGFError):
pgf.bootNGF("../haskell/tests/basic.gf", "./abc.ngf")
@pytest.mark.skip(reason="Bug in runtime")
def test_bootNGF_NGF(NGF):
with pytest.raises(pgf.PGFError):
pgf.bootNGF("./basic.ngf", "./abc.ngf")
def test_bootNGF_existing(NGF):
with pytest.raises(FileExistsError):
pgf.bootNGF("../haskell/tests/basicp.gf", "./basic.ngf")
# readNGF
@pytest.mark.skip(reason="Bug in runtime")
def test_readNGF_non_existant():
with pytest.raises(FileNotFoundError):
pgf.readNGF("./abc.ngf")
@pytest.mark.skip(reason="Bug in runtime")
def test_readNGF_GF():
with pytest.raises(pgf.PGFError):
pgf.readNGF("../haskell/tests/basic.gf")
@pytest.mark.skip(reason="Bug in runtime")
def test_readNGF_PGF():
with pytest.raises(pgf.PGFError):
pgf.readNGF("../haskell/tests/basic.pgf")
def test_readNGF(NGF):
pgf.readNGF("./basic.ngf")
# TODO assert load worked