Skip to content

Commit 9934559

Browse files
committed
adds pickle test for all destination caps
1 parent bee3720 commit 9934559

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

tests/common/destination/test_reference.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from collections.abc import MutableMapping
2-
from operator import eq
2+
import pickle
33
from typing import Dict
44

55
import pytest
@@ -14,7 +14,7 @@
1414
from dlt.common.normalizers.naming import sql_ci_v1, sql_cs_v1
1515

1616
from tests.common.configuration.utils import environment
17-
from tests.utils import ACTIVE_DESTINATIONS
17+
from tests.utils import IMPLEMENTED_DESTINATIONS
1818

1919

2020
def test_import_unknown_destination() -> None:
@@ -166,7 +166,7 @@ def test_import_module_by_path() -> None:
166166

167167
def test_import_all_destinations() -> None:
168168
# this must pass without the client dependencies being imported
169-
for dest_type in ACTIVE_DESTINATIONS:
169+
for dest_type in IMPLEMENTED_DESTINATIONS:
170170
dest = DestinationReference.from_reference(
171171
dest_type, None, dest_type + "_name", "production"
172172
)
@@ -175,7 +175,12 @@ def test_import_all_destinations() -> None:
175175
assert dest.config_params["environment"] == "production"
176176
assert dest.config_params["destination_name"] == dest_type + "_name"
177177
dest.spec()
178-
assert isinstance(dest.capabilities(), DestinationCapabilitiesContext)
178+
caps = dest.capabilities()
179+
assert isinstance(caps, DestinationCapabilitiesContext)
180+
# make sure caps are pickable
181+
pickled_caps = pickle.dumps(caps)
182+
unpickled_caps = pickle.loads(pickled_caps)
183+
assert caps.supported_loader_file_formats == unpickled_caps.supported_loader_file_formats
179184
# every destination is in the registry
180185
assert dest.destination_type in DestinationReference.DESTINATIONS
181186
assert DestinationReference.find(dest_type) is DestinationReference.find(

0 commit comments

Comments
 (0)