aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
authorPatrick Lehmann <Patrick.Lehmann@plc2.de>2020-12-31 10:20:01 +0100
committertgingold <tgingold@users.noreply.github.com>2021-01-01 11:19:04 +0100
commit41e7c0b3f5ae86d873587033732c4474530e779f (patch)
tree9b2ba04c1bf91afb80b4ff79abaa41fcadbfa9a4 /testsuite
parentb3b54942277e5146d43a8c549c00931f90258618 (diff)
downloadghdl-41e7c0b3f5ae86d873587033732c4474530e779f.tar.gz
ghdl-41e7c0b3f5ae86d873587033732c4474530e779f.tar.bz2
ghdl-41e7c0b3f5ae86d873587033732c4474530e779f.zip
Enable coverage collection in pytest.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/pyunit/dom/SimplePackage.py31
-rwxr-xr-xtestsuite/testsuite.sh2
2 files changed, 32 insertions, 1 deletions
diff --git a/testsuite/pyunit/dom/SimplePackage.py b/testsuite/pyunit/dom/SimplePackage.py
new file mode 100644
index 000000000..212e0402d
--- /dev/null
+++ b/testsuite/pyunit/dom/SimplePackage.py
@@ -0,0 +1,31 @@
+from pathlib import Path
+from unittest import TestCase
+
+from pyGHDL.dom.Misc import Design, Document
+
+
+if __name__ == "__main__":
+ print("ERROR: you called a testcase declaration file as an executable module.")
+ print("Use: 'python -m unitest <testcase module>'")
+ exit(1)
+
+
+class SimplePackage(TestCase):
+ _root = Path(__file__).resolve().parent.parent
+ _filename : Path = _root / "SimplePackage.vhdl"
+
+ def test_Package(self):
+ design = Design()
+ document = Document(self._filename)
+ design.Documents.append(document)
+
+ self.assertEqual(len(design.Documents[0].Packages), 1)
+ self.assertTrue(design.Documents[0].Packages[0].Name == "pack_1")
+
+ def test_PackageBody(self):
+ design = Design()
+ document = Document(self._filename)
+ design.Documents.append(document)
+
+ self.assertEqual(len(design.Documents[0].PackageBodies), 1)
+ self.assertTrue(design.Documents[0].PackageBodies[0].Name == "pack_1")
diff --git a/testsuite/testsuite.sh b/testsuite/testsuite.sh
index b1b69a7e2..9e4321034 100755
--- a/testsuite/testsuite.sh
+++ b/testsuite/testsuite.sh
@@ -141,7 +141,7 @@ do_gna () {
# The Python Unit testsuite: regression testsuite for Python bindings to libghdl
do_pyunit () {
gstart "[GHDL - test] pyunit"
- PYTHONPATH=$(pwd)/.. python3 -m pytest pyunit
+ PYTHONPATH=$(pwd)/.. python3 -m pytest -rA --cov=.. --cov-config=.coveragerc pyunit
gend
}