From 0985ba5de087208959fc81cca76cea50cfc0d749 Mon Sep 17 00:00:00 2001 From: Colton Loftus <70598503+C-Loftus@users.noreply.github.com> Date: Tue, 17 Dec 2024 14:04:25 -0500 Subject: [PATCH] better assertion handling --- userCode/main.py | 5 +++++ userCode/test/test_e2e.py | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/userCode/main.py b/userCode/main.py index 17b96de0..28bfbedc 100644 --- a/userCode/main.py +++ b/userCode/main.py @@ -92,6 +92,11 @@ def gleaner_config(context: AssetExecutionContext): sources = [] names = set() + + assert ( + len(Lines) > 0 + ), f"No sitemaps found in sitemap index {REMOTE_GLEANER_SITEMAP}" + for line in Lines: basename = REMOTE_GLEANER_SITEMAP.removesuffix(".xml") name = ( diff --git a/userCode/test/test_e2e.py b/userCode/test/test_e2e.py index dc08560c..d27326fc 100644 --- a/userCode/test/test_e2e.py +++ b/userCode/test/test_e2e.py @@ -10,7 +10,7 @@ from dagster import AssetsDefinition, AssetSpec, SourceAsset -def test_materialize_configs(): +def test_materialize_ref_hu02(): instance = DagsterInstance.ephemeral() assets = load_assets_from_modules([main]) @@ -34,10 +34,10 @@ def test_materialize_configs(): all_partitions = sources_partitions_def.get_partition_keys( dynamic_partitions_store=instance ) - assert len(all_partitions) > 0 + assert len(all_partitions) > 0, "Partitions were not generated" result = resolved_job.execute_in_process( instance=instance, partition_key="ref_hu02_hu02__0" ) - assert result.success + assert result.success, "Job execution failed for partition 'ref_hu02_hu02__0'"