From 260621701c7ce2eb6105c66d8904ebb18cc2ac97 Mon Sep 17 00:00:00 2001 From: Willi Date: Mon, 9 Sep 2024 13:58:14 +0530 Subject: [PATCH] removes setting of os.environ["LOAD__RAISE_ON_FAILED_JOBS"] = "true" and calls to raise_on_failed_jobs() --- tests/destinations/test_custom_destination.py | 10 ++++------ tests/destinations/test_destination_name_and_config.py | 3 --- tests/load/test_dummy_client.py | 6 ------ 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/tests/destinations/test_custom_destination.py b/tests/destinations/test_custom_destination.py index 6ebf7f6ef3..5b775d3efd 100644 --- a/tests/destinations/test_custom_destination.py +++ b/tests/destinations/test_custom_destination.py @@ -1,8 +1,7 @@ -from typing import List, Tuple, Dict, Union, cast +from typing import List, Tuple, Dict import dlt import pytest -import pytest import os import inspect @@ -498,17 +497,16 @@ def sink_func_with_spec( # call fails because `my_predefined_val` is required part of spec, even if not injected with pytest.raises(ConfigFieldMissingException): - info = dlt.pipeline("sink_test", destination=sink_func_with_spec(), dev_mode=True).run( + dlt.pipeline("sink_test", destination=sink_func_with_spec(), dev_mode=True).run( [1, 2, 3], table_name="items" ) - info.raise_on_failed_jobs() # call happens now os.environ["MY_PREDEFINED_VAL"] = "VAL" - info = dlt.pipeline("sink_test", destination=sink_func_with_spec(), dev_mode=True).run( + dlt.pipeline("sink_test", destination=sink_func_with_spec(), dev_mode=True).run( [1, 2, 3], table_name="items" ) - info.raise_on_failed_jobs() + # check destination with additional config params @dlt.destination(spec=MyDestinationSpec) diff --git a/tests/destinations/test_destination_name_and_config.py b/tests/destinations/test_destination_name_and_config.py index 1e432a7803..efaaafcfeb 100644 --- a/tests/destinations/test_destination_name_and_config.py +++ b/tests/destinations/test_destination_name_and_config.py @@ -1,6 +1,5 @@ import os import pytest -import posixpath import dlt from dlt.common.configuration.exceptions import ConfigFieldMissingException @@ -9,7 +8,6 @@ from dlt.common.storages import FilesystemConfiguration from dlt.destinations import duckdb, dummy, filesystem -from tests.common.configuration.utils import environment from tests.utils import TEST_STORAGE_ROOT @@ -71,7 +69,6 @@ def test_preserve_destination_instance() -> None: os.environ["COMPLETED_PROB"] = "1.0" load_info = p.run([1, 2, 3], table_name="table", dataset_name="dataset") - load_info.raise_on_failed_jobs() # destination and staging stay the same assert destination_id == id(p.destination) assert staging_id == id(p.staging) diff --git a/tests/load/test_dummy_client.py b/tests/load/test_dummy_client.py index b39de7ff33..1ae440c2f2 100644 --- a/tests/load/test_dummy_client.py +++ b/tests/load/test_dummy_client.py @@ -246,8 +246,6 @@ def test_spool_job_failed() -> None: def test_spool_job_failed_terminally_exception_init() -> None: - # this config fails job on start - os.environ["LOAD__RAISE_ON_FAILED_JOBS"] = "true" load = setup_loader(client_config=DummyClientConfiguration(fail_terminally_in_init=True)) load_id, _ = prepare_load_package(load.load_storage, NORMALIZED_FILES) with patch.object(dummy_impl.DummyClient, "complete_load") as complete_load: @@ -269,8 +267,6 @@ def test_spool_job_failed_terminally_exception_init() -> None: def test_spool_job_failed_transiently_exception_init() -> None: - # this config fails job on start - os.environ["LOAD__RAISE_ON_FAILED_JOBS"] = "true" load = setup_loader(client_config=DummyClientConfiguration(fail_transiently_in_init=True)) load_id, _ = prepare_load_package(load.load_storage, NORMALIZED_FILES) with patch.object(dummy_impl.DummyClient, "complete_load") as complete_load: @@ -293,8 +289,6 @@ def test_spool_job_failed_transiently_exception_init() -> None: def test_spool_job_failed_exception_complete() -> None: - # this config fails job on start - os.environ["LOAD__RAISE_ON_FAILED_JOBS"] = "true" load = setup_loader(client_config=DummyClientConfiguration(fail_prob=1.0)) load_id, _ = prepare_load_package(load.load_storage, NORMALIZED_FILES) with pytest.raises(LoadClientJobFailed) as py_ex: