Skip to content

Commit

Permalink
removes setting of os.environ["LOAD__RAISE_ON_FAILED_JOBS"] = "true" …
Browse files Browse the repository at this point in the history
…and calls to raise_on_failed_jobs()
  • Loading branch information
willi-mueller committed Sep 9, 2024
1 parent 0703bd2 commit 2606217
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
10 changes: 4 additions & 6 deletions tests/destinations/test_custom_destination.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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)
Expand Down
3 changes: 0 additions & 3 deletions tests/destinations/test_destination_name_and_config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
import pytest
import posixpath

import dlt
from dlt.common.configuration.exceptions import ConfigFieldMissingException
Expand All @@ -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


Expand Down Expand Up @@ -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)
Expand Down
6 changes: 0 additions & 6 deletions tests/load/test_dummy_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit 2606217

Please sign in to comment.