From 4c969a09160a2308d2321e8837faf8e5d2bb69c6 Mon Sep 17 00:00:00 2001 From: "Oscar A. Rangel" Date: Mon, 3 Jun 2024 16:17:31 +0000 Subject: [PATCH] adding scaffold --- Makefile | 15 +++++++++++++++ hello.py | 15 +++++++++++++++ requirements.txt | 3 +++ test_hello.py | 21 +++++++++++++++++++++ 4 files changed, 54 insertions(+) create mode 100644 Makefile create mode 100644 hello.py create mode 100644 requirements.txt create mode 100644 test_hello.py diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f255f12 --- /dev/null +++ b/Makefile @@ -0,0 +1,15 @@ +install: + pip install --upgrade pip &&\ + pip install -r requirements.txt + +test: + python -m pytest -vv test_hello.py + +format: + black *.py + + +lint: + pylint --disable=R,C hello.py + +all: install lint test \ No newline at end of file diff --git a/hello.py b/hello.py new file mode 100644 index 0000000..428fb04 --- /dev/null +++ b/hello.py @@ -0,0 +1,15 @@ +#var=1 +#var=var + +def toyou(x): + return f"hi {x}" + + +def add(x): + return x + 1 + + +def subtract(x): + return x - 1 + + \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..70b45ee --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +pylint +pytest +black diff --git a/test_hello.py b/test_hello.py new file mode 100644 index 0000000..3bb3559 --- /dev/null +++ b/test_hello.py @@ -0,0 +1,21 @@ +from hello import toyou, add, subtract + + +def setup_function(function): + print(f" Running Setup: {function.__name__}") + function.x = 10 + + +def teardown_function(function): + print(f" Running Teardown: {function.__name__}") + del function.x + + +### Run to see failed test +#def test_hello_add(): +# assert add(test_hello_add.x) == 12 + +def test_hello_subtract(): + assert subtract(test_hello_subtract.x) == 9 + + \ No newline at end of file