Skip to content

Commit

Permalink
[MAINTENANCE] Add pytest.deprecated_call to misc usages of `add_dat…
Browse files Browse the repository at this point in the history
…asource` in tests (#8207)
  • Loading branch information
cdkini committed Jun 28, 2023
1 parent 8e4ec20 commit 3653d41
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 29 deletions.
9 changes: 5 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3600,10 +3600,11 @@ def set_side_effect(key, value):
"great_expectations.data_context.store.datasource_store.DatasourceStore.set",
side_effect=set_side_effect,
):
context.add_datasource(
"my_datasource",
**config,
)
with pytest.deprecated_call(): # non-FDS datasources discouraged in Cloud
context.add_datasource(
"my_datasource",
**config,
)
return context


Expand Down
56 changes: 31 additions & 25 deletions tests/data_context/cloud_data_context/test_datasource_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,22 +211,25 @@ def test_data_context_in_cloud_mode_add_datasource(
expected_datasource_config = datasourceConfigSchema.dump(
block_config_datasource_config
)
stored_datasource = context.add_datasource(
name=datasource_name,
**expected_datasource_config,
)
with pytest.deprecated_call(): # non-FDS datasources discouraged in Cloud
stored_datasource = context.add_datasource(
name=datasource_name,
**expected_datasource_config,
)
elif config_includes_name_setting == "config_includes_name":
stored_datasource = context.add_datasource(
**datasource_config_with_name.to_dict()
)
with pytest.deprecated_call(): # non-FDS datasources discouraged in Cloud
stored_datasource = context.add_datasource(
**datasource_config_with_name.to_dict()
)
elif (
config_includes_name_setting
== "name_supplied_separately_and_included_in_config"
):
stored_datasource = context.add_datasource(
name=datasource_name,
**datasource_config_with_name.to_dict(),
)
with pytest.deprecated_call(): # non-FDS datasources discouraged in Cloud
stored_datasource = context.add_datasource(
name=datasource_name,
**datasource_config_with_name.to_dict(),
)
else:
raise ValueError(
"Invalid value provided for 'config_includes_name_setting'"
Expand Down Expand Up @@ -323,25 +326,28 @@ def test_cloud_data_context_add_datasource(
expected_datasource_config = datasourceConfigSchema.dump(
block_config_datasource_config
)
stored_datasource = context.add_datasource(
name=datasource_name,
**expected_datasource_config,
save_changes=True,
)
with pytest.deprecated_call(): # non-FDS datasources discouraged in Cloud
stored_datasource = context.add_datasource(
name=datasource_name,
**expected_datasource_config,
save_changes=True,
)
elif config_includes_name_setting == "config_includes_name":
stored_datasource = context.add_datasource(
**datasource_config_with_name.to_dict(),
save_changes=True,
)
with pytest.deprecated_call(): # non-FDS datasources discouraged in Cloud
stored_datasource = context.add_datasource(
**datasource_config_with_name.to_dict(),
save_changes=True,
)
elif (
config_includes_name_setting
== "name_supplied_separately_and_included_in_config"
):
stored_datasource = context.add_datasource(
name=datasource_name,
**datasource_config_with_name.to_dict(),
save_changes=True,
)
with pytest.deprecated_call(): # non-FDS datasources discouraged in Cloud
stored_datasource = context.add_datasource(
name=datasource_name,
**datasource_config_with_name.to_dict(),
save_changes=True,
)
else:
raise ValueError(
"Invalid value provided for 'config_includes_name_setting'"
Expand Down

0 comments on commit 3653d41

Please sign in to comment.