From 0f7dc5b073c70cf9c1fa8b9e028f28cfff12073e Mon Sep 17 00:00:00 2001 From: Klaas <kliffen@astron.nl> Date: Wed, 31 Aug 2022 16:01:37 +0200 Subject: [PATCH] Add example tests --- .gitignore | 2 ++ tests/requirements.txt | 2 ++ tests/test_cool_module.py | 13 +++++++++++++ tox.ini | 3 ++- 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 tests/test_cool_module.py diff --git a/.gitignore b/.gitignore index f338579..67eac53 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ dist/* *.egg-info *.pyc + +.coverage diff --git a/tests/requirements.txt b/tests/requirements.txt index 4a545b2..c28d83e 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -2,3 +2,5 @@ black build flake8 pylint +pytest +pytest-cov diff --git a/tests/test_cool_module.py b/tests/test_cool_module.py new file mode 100644 index 0000000..da1002b --- /dev/null +++ b/tests/test_cool_module.py @@ -0,0 +1,13 @@ +"""Testing of the Cool Module""" +from unittest import TestCase + +from map.cool_module import greeter + + +class TestCoolModule(TestCase): + """Test Case of the Cool Module""" + + def test_greeter(self): + """Testing that the greeter does not crash""" + greeter() + self.assertEqual(2 + 2, 4) diff --git a/tox.ini b/tox.ini index 0a54384..0c73407 100644 --- a/tox.ini +++ b/tox.ini @@ -16,6 +16,7 @@ deps = -r{toxinidir}/tests/requirements.txt commands = {envpython} --version + {envpython} -m pytest --cov=map # Use generative name and command prefixes to reuse the same virtualenv # for all linting jobs. @@ -28,7 +29,7 @@ commands = black: {envpython} -m black --version black: {envpython} -m black --check --diff . pylint: {envpython} -m pylint --version - pylint: {envpython} -m pylint map + pylint: {envpython} -m pylint map tests [testenv:build] usedevelop = False -- GitLab