From e2472f935d8c5067bcad7b79c3cce9d5c4d416d4 Mon Sep 17 00:00:00 2001 From: Alexis Koralewski Date: Fri, 26 May 2023 15:47:33 +0200 Subject: [PATCH] Add option on test command to run one test method --- CHANGELOG | 4 ++++ VERSION | 2 +- pyros.py | 8 ++++++-- src/core/pyros_django/api/tests.py | 2 +- src/core/pyros_django/misc/fixtures/tests/complete_fixture.json | 12 ------------ 5 files changed, 12 insertions(+), 16 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index c2a6a61..76eb633 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +26-05-2023 (AKo): V0.6.24.0 + - Update agents & astronomer obsconfig view to get channels components + - Add option on test command to run one test method + 22-05-2023 (AKo): V0.6.24.0 - Update Obsconfig schema to add components & agents to channels config diff --git a/VERSION b/VERSION index 97a0ebf..852b766 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.6.23.0 \ No newline at end of file +0.6.24.0 \ No newline at end of file diff --git a/pyros.py b/pyros.py index 676aa8c..e724f37 100755 --- a/pyros.py +++ b/pyros.py @@ -708,7 +708,8 @@ def install_or_update(UPDATE: bool = False, with_packages: bool = True, with_dat @pyros_launcher.command(help="Run some tests") @click.option('--app', '-a', help='app name') -def test(app): +@click.option('--function', '-f', help='function name') +def test(app, function): print("Running tests") os.environ["PATH_TO_OBSCONF_FOLDER"] = os.path.join( os.path.abspath(PYROS_DJANGO_BASE_DIR), "obsconfig/fixtures/") @@ -729,8 +730,11 @@ def test(app): os.environ["PATH_TO_OBSCONF_FILE"] = os.path.join(os.path.abspath( PYROS_DJANGO_BASE_DIR), "obsconfig/fixtures/observatory_configuration_ok_simple.yml") change_dir(PYROS_DJANGO_BASE_DIR) + cmd = 'manage.py test --keep --noinput --parallel 4 ' + app + if function: + cmd += ".tests."+function execProcessFromVenv( - 'manage.py test --keep --noinput --parallel 4 ' + app,foreground=True) or die() + cmd, foreground=True) or die() change_dir("PREVIOUS") return True for app in apps: diff --git a/src/core/pyros_django/api/tests.py b/src/core/pyros_django/api/tests.py index bd72123..94f040d 100644 --- a/src/core/pyros_django/api/tests.py +++ b/src/core/pyros_django/api/tests.py @@ -107,7 +107,7 @@ class TestAPI(APITestCase): url = '/api/plans/1' response = self.client.get(url,follow=True) self.assertEqual(response.status_code,200) - self.assertEqual(response.data.get("name"),Plan.objects.get(id=1).name) + self.assertEqual(response.data.get("id"),Plan.objects.get(id=1).id) def test_full_sequence_list(self): user = PyrosUser.objects.get(username="pyros") diff --git a/src/core/pyros_django/misc/fixtures/tests/complete_fixture.json b/src/core/pyros_django/misc/fixtures/tests/complete_fixture.json index 844fa3e..773a937 100644 --- a/src/core/pyros_django/misc/fixtures/tests/complete_fixture.json +++ b/src/core/pyros_django/misc/fixtures/tests/complete_fixture.json @@ -5119,7 +5119,6 @@ "last_modified_by": null, "is_alert": false, "status": "DRAFT", - "target_coords": "RADEC 0H10M -15D", "with_drift": false, "priority": null, "analysis_method": null, @@ -5168,7 +5167,6 @@ "last_modified_by": null, "is_alert": false, "status": "TBP", - "target_coords": null, "with_drift": false, "priority": null, "analysis_method": null, @@ -5215,7 +5213,6 @@ "last_modified_by": null, "is_alert": false, "status": "TBP", - "target_coords": null, "with_drift": false, "priority": null, "analysis_method": null, @@ -5262,7 +5259,6 @@ "last_modified_by": null, "is_alert": false, "status": "TBP", - "target_coords": null, "with_drift": false, "priority": null, "analysis_method": null, @@ -5309,7 +5305,6 @@ "last_modified_by": null, "is_alert": false, "status": null, - "target_coords": null, "with_drift": false, "priority": null, "analysis_method": null, @@ -5352,7 +5347,6 @@ "last_modified_by": null, "is_alert": false, "status": null, - "target_coords": null, "with_drift": false, "priority": null, "analysis_method": null, @@ -5395,7 +5389,6 @@ "last_modified_by": null, "is_alert": false, "status": "TBP", - "target_coords": null, "with_drift": false, "priority": null, "analysis_method": null, @@ -5442,7 +5435,6 @@ "last_modified_by": null, "is_alert": false, "status": "TBP", - "target_coords": null, "with_drift": false, "priority": null, "analysis_method": null, @@ -5489,7 +5481,6 @@ "last_modified_by": null, "is_alert": false, "status": "TBP", - "target_coords": null, "with_drift": false, "priority": null, "analysis_method": null, @@ -5536,7 +5527,6 @@ "last_modified_by": null, "is_alert": false, "status": null, - "target_coords": null, "with_drift": false, "priority": null, "analysis_method": null, @@ -5579,7 +5569,6 @@ "last_modified_by": null, "is_alert": false, "status": null, - "target_coords": null, "with_drift": false, "priority": null, "analysis_method": null, @@ -5622,7 +5611,6 @@ "last_modified_by": null, "is_alert": false, "status": null, - "target_coords": null, "with_drift": false, "priority": null, "analysis_method": null, -- libgit2 0.21.2