From c95568e3b8ba6e59deb0f04d32c4e9c5203d5ae0 Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Tue, 18 Feb 2020 21:02:50 +0100 Subject: [PATCH] Import pytest and created some test- test scripts. --- requirements.txt | 1 + test/__init__.py | 0 test/test_import.py | 6 ++++++ test/test_square.py | 9 +++++++++ 4 files changed, 16 insertions(+) create mode 100644 test/__init__.py create mode 100644 test/test_import.py create mode 100644 test/test_square.py diff --git a/requirements.txt b/requirements.txt index 636925a..8e800f0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,3 +5,4 @@ enzyme>=0.4.1 click>=6.7 langdetect>=1.0.7 titlecase>=0.12.0 +pytest>=5.3.5 diff --git a/test/__init__.py b/test/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test/test_import.py b/test/test_import.py new file mode 100644 index 0000000..dedea7c --- /dev/null +++ b/test/test_import.py @@ -0,0 +1,6 @@ +import sys, os +sys.path.append(os.path.realpath(os.path.dirname(__file__)+"/../src")) + +def test_import_env_variables(): + import env_variables as env + assert env.logfile == 'conf/output.log' diff --git a/test/test_square.py b/test/test_square.py new file mode 100644 index 0000000..419c80b --- /dev/null +++ b/test/test_square.py @@ -0,0 +1,9 @@ + +def square(x): + return x * x + +def test_square(): + assert square(2) == 4 + +def test_square_negative(): + assert square(-2) == 4