From 880cc90c14f5d8ffa555d12f691785e79a3d6c54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20S=C3=A1nchez=20Parra?= Date: Fri, 5 Jul 2019 12:40:06 +0200 Subject: [PATCH] #915 Improve test output using unittest discover * Call the tests with python module unittest. In particular, the discover function. * Rename tests files to meet the default requirements of discover function. --- tests/run-tests.py | 3 +-- tests/units/{0001-get-clients.py => test_0001_get_clients.py} | 0 .../units/{0002-post-clients.py => test_0002_post_clients.py} | 0 tests/units/{0003-post-wol.py => test_0003_post_wol.py} | 0 .../{0004-post-shell-run.py => test_0004_post_shell_run.py} | 0 ...005-post-shell-output.py => test_0005_post_shell_output.py} | 0 .../units/{0006-post-session.py => test_0006_post_session.py} | 0 7 files changed, 1 insertion(+), 2 deletions(-) rename tests/units/{0001-get-clients.py => test_0001_get_clients.py} (100%) rename tests/units/{0002-post-clients.py => test_0002_post_clients.py} (100%) rename tests/units/{0003-post-wol.py => test_0003_post_wol.py} (100%) rename tests/units/{0004-post-shell-run.py => test_0004_post_shell_run.py} (100%) rename tests/units/{0005-post-shell-output.py => test_0005_post_shell_output.py} (100%) rename tests/units/{0006-post-session.py => test_0006_post_session.py} (100%) diff --git a/tests/run-tests.py b/tests/run-tests.py index f0ddb87..126105d 100755 --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -30,8 +30,7 @@ start_mysql(); subprocess.Popen(['../ogAdmServer', '-f', 'config/ogAdmServer.cfg']) -for filename in glob.iglob('units/**'): - subprocess.run(['python3', filename, '-v']) +subprocess.run('python3 -m unittest discover -s units -v', shell=True) stop_mysql(); diff --git a/tests/units/0001-get-clients.py b/tests/units/test_0001_get_clients.py similarity index 100% rename from tests/units/0001-get-clients.py rename to tests/units/test_0001_get_clients.py diff --git a/tests/units/0002-post-clients.py b/tests/units/test_0002_post_clients.py similarity index 100% rename from tests/units/0002-post-clients.py rename to tests/units/test_0002_post_clients.py diff --git a/tests/units/0003-post-wol.py b/tests/units/test_0003_post_wol.py similarity index 100% rename from tests/units/0003-post-wol.py rename to tests/units/test_0003_post_wol.py diff --git a/tests/units/0004-post-shell-run.py b/tests/units/test_0004_post_shell_run.py similarity index 100% rename from tests/units/0004-post-shell-run.py rename to tests/units/test_0004_post_shell_run.py diff --git a/tests/units/0005-post-shell-output.py b/tests/units/test_0005_post_shell_output.py similarity index 100% rename from tests/units/0005-post-shell-output.py rename to tests/units/test_0005_post_shell_output.py diff --git a/tests/units/0006-post-session.py b/tests/units/test_0006_post_session.py similarity index 100% rename from tests/units/0006-post-session.py rename to tests/units/test_0006_post_session.py