From aacf7a8385a79d1dd494dfeba9d09d3a797c70ef Mon Sep 17 00:00:00 2001
From: Kevin Scott <kevsc634@student.liu.se>
Date: Tue, 25 Feb 2020 11:54:30 +0100
Subject: [PATCH] Added support for pytest and updated readme

---
 README.md          | 13 ++++++++++++-
 setup.py           |  3 ++-
 tests/__init__.py  |  0
 tests/test_port.py | 10 ++++++++++
 4 files changed, 24 insertions(+), 2 deletions(-)
 create mode 100644 tests/__init__.py
 create mode 100644 tests/test_port.py

diff --git a/README.md b/README.md
index bcd09857..97c65156 100644
--- a/README.md
+++ b/README.md
@@ -88,6 +88,17 @@ python3
 >>> help(asic)
 ```
 
+## Running tests
+### pytest
+Run all tests against installed version off b_asic using a virtual enviroment
+In `B-ASIC`:
+```
+python3 -m venv .venv
+source .venv/bin/activate
+pip install .
+pytest
+```
+
 ## License
 B-ASIC is distributed under the MIT license.
-See the included LICENSE file for more information.
\ No newline at end of file
+See the included LICENSE file for more information.
diff --git a/setup.py b/setup.py
index 71ae4e4a..0b591cbb 100644
--- a/setup.py
+++ b/setup.py
@@ -70,7 +70,8 @@ setuptools.setup(
     install_requires = [
         "pybind11>=2.3.0",
         "numpy",
-        "install_qt_binding"
+        "install_qt_binding",
+        "pytest==5.3.4"
     ],
     packages = ["b_asic"],
     ext_modules = [CMakeExtension("b_asic")],
diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/tests/test_port.py b/tests/test_port.py
new file mode 100644
index 00000000..498233bb
--- /dev/null
+++ b/tests/test_port.py
@@ -0,0 +1,10 @@
+from b_asic import InputPort
+import pytest
+
+@pytest.fixture
+def outp_port():
+    return InputPort(0)
+
+
+def test_port(outp_port):
+    assert outp_port.signals() == []
-- 
GitLab