Skip to content

Commit

Permalink
TST: Add docstring and improve manifest generation method
Browse files Browse the repository at this point in the history
  • Loading branch information
cortadocodes committed Jun 27, 2023
1 parent a2fa14a commit 833cfe7
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tests/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,11 @@ def _make_serialised_input_manifest_with_correct_dataset_file_tags(self, dataset

class TestRunnerCrashDiagnostics(BaseTestCase):
def _generate_manifests(self, serialise=False):
"""Generate configuration and input manifests containing dummy data.
:param bool serialise: if this is `True`, serialise the manifests and use the dataset serialisation within them instead of the dataset paths
:return tuple(octue.resources.manifest.Manifest, octue.resources.manifest.Manifest): the input and configuration manifests
"""
manifests = {}

for data_type in ("configuration", "input"):
Expand All @@ -721,7 +726,7 @@ def _generate_manifests(self, serialise=False):
else:
manifests[data_type] = {"id": str(uuid.uuid4()), "datasets": {"met_mast_data": dataset_path}}

return manifests
return manifests["configuration"], manifests["input"]

def test_crash_diagnostics_with_unserialised_and_serialised_data(self):
"""Test that unserialised and serialised analysis configurations and inputs are saved to the crash diagnostics
Expand All @@ -743,7 +748,7 @@ def app(analysis):
for serialise in (False, True):
for values in ({"hello": "world"}, '{"hello": "world"}'):
with self.subTest(serialise=serialise, values=values):
manifests = self._generate_manifests(serialise=serialise)
configuration_manifest, input_manifest = self._generate_manifests(serialise=serialise)

runner = Runner(
app_src=app,
Expand All @@ -758,7 +763,7 @@ def app(analysis):
"input_manifest": {"datasets": {}},
},
configuration_values=values,
configuration_manifest=manifests["configuration"],
configuration_manifest=configuration_manifest,
children=[
{
"key": "my-child",
Expand Down Expand Up @@ -806,7 +811,7 @@ def app(analysis):
runner.run(
analysis_id=analysis_id,
input_values=values,
input_manifest=manifests["input"],
input_manifest=input_manifest,
allow_save_diagnostics_data_on_crash=True,
)

Expand Down

0 comments on commit 833cfe7

Please sign in to comment.