From 9148ea7985d691709e4d4b37b15bc10fdf821f76 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Mon, 9 Dec 2019 16:04:26 +1300 Subject: [PATCH] Python support: check for the validity and issues of a simulation file (#2178). --- .../support/PythonSupport/tests/data/tests.out | 18 ++++++++++++++++++ .../support/PythonSupport/tests/data/tests.py | 10 ++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/plugins/support/PythonSupport/tests/data/tests.out b/src/plugins/support/PythonSupport/tests/data/tests.out index e544c96a92..31b153dfb4 100755 --- a/src/plugins/support/PythonSupport/tests/data/tests.out +++ b/src/plugins/support/PythonSupport/tests/data/tests.out @@ -14,6 +14,9 @@ OSError("'https://unknown' could not be opened (host unknown not found).") Local CellML file --------------------------------------- - Open file... + - Check file... + - Valid: YES + - Issues: N/A - Run file... - Retrieve simulation results... - Retrieve states... @@ -23,6 +26,9 @@ OSError("'https://unknown' could not be opened (host unknown not found).") Remote CellML file --------------------------------------- - Open file... + - Check file... + - Valid: YES + - Issues: N/A - Run file... - Retrieve simulation results... - Retrieve states... @@ -32,6 +38,9 @@ OSError("'https://unknown' could not be opened (host unknown not found).") Local SED-ML file --------------------------------------- - Open file... + - Check file... + - Valid: YES + - Issues: N/A - Run file... - Retrieve simulation results... - Retrieve states... @@ -41,6 +50,9 @@ OSError("'https://unknown' could not be opened (host unknown not found).") Remote SED-ML file --------------------------------------- - Open file... + - Check file... + - Valid: YES + - Issues: N/A - Run file... - Retrieve simulation results... - Retrieve states... @@ -50,6 +62,9 @@ OSError("'https://unknown' could not be opened (host unknown not found).") Local COMBINE archive --------------------------------------- - Open file... + - Check file... + - Valid: YES + - Issues: N/A - Run file... - Retrieve simulation results... - Retrieve states... @@ -59,6 +74,9 @@ OSError("'https://unknown' could not be opened (host unknown not found).") Remote COMBINE archive --------------------------------------- - Open file... + - Check file... + - Valid: YES + - Issues: N/A - Run file... - Retrieve simulation results... - Retrieve states... diff --git a/src/plugins/support/PythonSupport/tests/data/tests.py b/src/plugins/support/PythonSupport/tests/data/tests.py index f3f7d85dbc..e16c1ca7b5 100755 --- a/src/plugins/support/PythonSupport/tests/data/tests.py +++ b/src/plugins/support/PythonSupport/tests/data/tests.py @@ -19,6 +19,16 @@ def run_simulation(title: str, file_name_or_url: str, first: bool = True) -> obj simulation = oc.open_simulation( os.path.dirname(__file__) + '/../../../../../../models/tests/' + file_name_or_url) + print(' - Check file...') + print(' - Valid: ' + ('YES' if simulation.valid() else 'NO')) + + issues = simulation.issues() + + if issues: + print(' - Issues:\n - ' + '\n - '.join(simulation.issues())) + else: + print(' - Issues: N/A') + print(' - Run file...') simulation.run()