summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJensDiemer <git@jensdiemer.de>2020-01-19 00:07:34 +0100
committerJensDiemer <git@jensdiemer.de>2020-01-19 00:07:34 +0100
commit384a09445983c2d336cf9069663f1e6a5d150a3b (patch)
treeb95d2e0a3c49b415b853dd2b5e31c0387440aca1
parentffa17afcdf04339562c27211e1e5f2e5356d22d4 (diff)
downloadcreole-384a09445983c2d336cf9069663f1e6a5d150a3b.tar.gz
Bugfix "check-poetry" output and add simple tests for Makefile
-rw-r--r--Makefile2
-rw-r--r--creole/tests/test_Makefile.py29
-rw-r--r--creole/tests/utils/unittest_subprocess.py5
3 files changed, 35 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 20deb83..669086e 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@ help: ## List all commands
check-poetry:
@if [[ "${POETRY_VERSION}" == *"Poetry"* ]] ; \
then \
- echo "Found version poetry v${POETRY_VERSION}, ok." ; \
+ echo "Found ${POETRY_VERSION}, ok." ; \
else \
echo 'Please install poetry first, with e.g.:' ; \
echo 'make install-poetry' ; \
diff --git a/creole/tests/test_Makefile.py b/creole/tests/test_Makefile.py
new file mode 100644
index 0000000..dbf129c
--- /dev/null
+++ b/creole/tests/test_Makefile.py
@@ -0,0 +1,29 @@
+
+"""
+ :copyleft: 2020 by python-creole team, see AUTHORS for more details.
+ :license: GNU GPL v3 or above, see LICENSE for more details.
+"""
+
+import unittest
+
+from creole.tests.utils.unittest_subprocess import SubprocessMixin
+
+
+class MakefileTestCase(unittest.TestCase, SubprocessMixin):
+
+ def test_help(self):
+ popen_args, retcode, stdout = self.subprocess(
+ popen_args=["make"],
+ )
+ assert "List all commands" in stdout
+ assert "tox" in stdout
+ assert "pytest" in stdout
+ assert retcode == 0
+
+ def test_check_poetry(self):
+ popen_args, retcode, stdout = self.subprocess(
+ popen_args=["make", "check-poetry"],
+ )
+ assert "Found Poetry version 1." in stdout
+ assert "ok" in stdout
+ assert retcode == 0
diff --git a/creole/tests/utils/unittest_subprocess.py b/creole/tests/utils/unittest_subprocess.py
index 3fe4b3c..16ef649 100644
--- a/creole/tests/utils/unittest_subprocess.py
+++ b/creole/tests/utils/unittest_subprocess.py
@@ -51,6 +51,11 @@ class SubprocessMixin:
print(f"stderr: {stderr!r}")
stdout = stdout.strip()
+ print("="*100)
+ print("stdout:")
+ print("-"*100)
+ print(stdout)
+ print("-"*100)
return popen_args, retcode, stdout
def assertSubprocess(self, popen_args, retcode, stdout):