From 5f884e6099e88c1909042bf12ce622dabfe107da Mon Sep 17 00:00:00 2001 From: Deepyaman Datta Date: Mon, 2 Oct 2023 17:29:26 -0500 Subject: [PATCH] feat(datasets): create custom `DeprecationWarning` (#356) * feat(datasets): create custom `DeprecationWarning` Signed-off-by: Deepyaman Datta * feat(datasets): use the custom deprecation warning Signed-off-by: Deepyaman Datta * chore(datasets): show Kedro's deprecation warnings Signed-off-by: Deepyaman Datta * fix(datasets): remove unused imports in test files Signed-off-by: Deepyaman Datta --------- Signed-off-by: Deepyaman Datta --- kedro-datasets/kedro_datasets/__init__.py | 16 ++++++++++++++++ kedro-datasets/kedro_datasets/api/api_dataset.py | 3 ++- .../biosequence/biosequence_dataset.py | 3 ++- .../kedro_datasets/dask/parquet_dataset.py | 3 ++- .../databricks/managed_table_dataset.py | 3 ++- .../kedro_datasets/email/message_dataset.py | 3 ++- .../kedro_datasets/geopandas/geojson_dataset.py | 3 ++- .../kedro_datasets/json/json_dataset.py | 3 ++- .../kedro_datasets/networkx/gml_dataset.py | 3 ++- .../kedro_datasets/networkx/graphml_dataset.py | 3 ++- .../kedro_datasets/networkx/json_dataset.py | 3 ++- .../kedro_datasets/pandas/csv_dataset.py | 3 ++- .../kedro_datasets/pandas/deltatable_dataset.py | 3 ++- .../kedro_datasets/pandas/excel_dataset.py | 3 ++- .../kedro_datasets/pandas/feather_dataset.py | 3 ++- .../kedro_datasets/pandas/gbq_dataset.py | 3 ++- .../kedro_datasets/pandas/generic_dataset.py | 3 ++- .../kedro_datasets/pandas/hdf_dataset.py | 3 ++- .../kedro_datasets/pandas/json_dataset.py | 3 ++- .../kedro_datasets/pandas/parquet_dataset.py | 3 ++- .../kedro_datasets/pandas/sql_dataset.py | 3 ++- .../kedro_datasets/pandas/xml_dataset.py | 3 ++- .../kedro_datasets/pickle/pickle_dataset.py | 3 ++- .../kedro_datasets/pillow/image_dataset.py | 3 ++- .../kedro_datasets/plotly/json_dataset.py | 3 ++- .../kedro_datasets/plotly/plotly_dataset.py | 5 +++-- .../kedro_datasets/polars/csv_dataset.py | 3 ++- .../kedro_datasets/polars/generic_dataset.py | 3 ++- .../kedro_datasets/redis/redis_dataset.py | 3 ++- .../kedro_datasets/snowflake/snowpark_dataset.py | 3 ++- .../kedro_datasets/spark/deltatable_dataset.py | 3 ++- .../kedro_datasets/spark/spark_dataset.py | 3 ++- .../kedro_datasets/spark/spark_hive_dataset.py | 3 ++- .../kedro_datasets/spark/spark_jdbc_dataset.py | 3 ++- .../spark/spark_streaming_dataset.py | 3 ++- .../kedro_datasets/svmlight/svmlight_dataset.py | 3 ++- .../tensorflow/tensorflow_model_dataset.py | 3 ++- .../kedro_datasets/text/text_dataset.py | 3 ++- .../kedro_datasets/tracking/json_dataset.py | 3 ++- .../kedro_datasets/tracking/metrics_dataset.py | 3 ++- .../kedro_datasets/video/video_dataset.py | 3 ++- .../kedro_datasets/yaml/yaml_dataset.py | 3 ++- kedro-datasets/tests/api/test_api_dataset.py | 5 ++++- .../biosequence/test_biosequence_dataset.py | 5 ++++- .../tests/dask/test_parquet_dataset.py | 5 ++++- .../databricks/test_managed_table_dataset.py | 5 ++++- .../tests/email/test_message_dataset.py | 5 ++++- .../tests/geopandas/test_geojson_dataset.py | 5 ++++- kedro-datasets/tests/json/test_json_dataset.py | 5 ++++- .../tests/networkx/test_gml_dataset.py | 5 ++++- .../tests/networkx/test_graphml_dataset.py | 5 ++++- .../tests/networkx/test_json_dataset.py | 5 ++++- kedro-datasets/tests/pandas/test_csv_dataset.py | 5 ++++- .../tests/pandas/test_deltatable_dataset.py | 5 ++++- .../tests/pandas/test_excel_dataset.py | 5 ++++- .../tests/pandas/test_feather_dataset.py | 5 ++++- kedro-datasets/tests/pandas/test_gbq_dataset.py | 5 ++++- .../tests/pandas/test_generic_dataset.py | 5 ++++- kedro-datasets/tests/pandas/test_hdf_dataset.py | 5 ++++- kedro-datasets/tests/pandas/test_json_dataset.py | 5 ++++- .../tests/pandas/test_parquet_dataset.py | 5 ++++- kedro-datasets/tests/pandas/test_sql_dataset.py | 5 ++++- kedro-datasets/tests/pandas/test_xml_dataset.py | 5 ++++- .../tests/pickle/test_pickle_dataset.py | 5 ++++- .../tests/pillow/test_image_dataset.py | 5 ++++- kedro-datasets/tests/plotly/test_json_dataset.py | 5 ++++- .../tests/plotly/test_plotly_dataset.py | 5 ++++- kedro-datasets/tests/polars/test_csv_dataset.py | 5 ++++- .../tests/polars/test_generic_dataset.py | 5 ++++- kedro-datasets/tests/redis/test_redis_dataset.py | 5 ++++- .../tests/snowflake/test_snowpark_dataset.py | 5 ++++- .../tests/spark/test_deltatable_dataset.py | 5 ++++- kedro-datasets/tests/spark/test_spark_dataset.py | 5 ++++- .../tests/spark/test_spark_hive_dataset.py | 5 ++++- .../tests/spark/test_spark_jdbc_dataset.py | 5 ++++- .../tests/spark/test_spark_streaming_dataset.py | 5 ++++- .../tests/svmlight/test_svmlight_dataset.py | 5 ++++- .../tensorflow/test_tensorflow_model_dataset.py | 5 ++++- kedro-datasets/tests/text/test_text_dataset.py | 5 ++++- .../tests/tracking/test_json_dataset.py | 5 ++++- .../tests/tracking/test_metrics_dataset.py | 5 ++++- kedro-datasets/tests/video/test_video_dataset.py | 5 ++++- kedro-datasets/tests/yaml/test_yaml_dataset.py | 5 ++++- 83 files changed, 263 insertions(+), 83 deletions(-) diff --git a/kedro-datasets/kedro_datasets/__init__.py b/kedro-datasets/kedro_datasets/__init__.py index f06eb30db..13f456ad3 100644 --- a/kedro-datasets/kedro_datasets/__init__.py +++ b/kedro-datasets/kedro_datasets/__init__.py @@ -1,3 +1,19 @@ """``kedro_datasets`` is where you can find all of Kedro's data connectors.""" +__all__ = ["KedroDeprecationWarning"] __version__ = "1.7.0" + +import sys +import warnings + +try: + # Custom `KedroDeprecationWarning` class was added in Kedro 0.18.14. + from kedro import KedroDeprecationWarning +except ImportError: + + class KedroDeprecationWarning(DeprecationWarning): + """Custom class for warnings about deprecated Kedro features.""" + + +if not sys.warnoptions: + warnings.simplefilter("default", KedroDeprecationWarning) diff --git a/kedro-datasets/kedro_datasets/api/api_dataset.py b/kedro-datasets/kedro_datasets/api/api_dataset.py index 8a696f456..b40ab1640 100644 --- a/kedro-datasets/kedro_datasets/api/api_dataset.py +++ b/kedro-datasets/kedro_datasets/api/api_dataset.py @@ -10,6 +10,7 @@ from requests import Session, sessions from requests.auth import AuthBase +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractDataset, DatasetError @@ -248,7 +249,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/biosequence/biosequence_dataset.py b/kedro-datasets/kedro_datasets/biosequence/biosequence_dataset.py index d24d38ba0..ebd0722f5 100644 --- a/kedro-datasets/kedro_datasets/biosequence/biosequence_dataset.py +++ b/kedro-datasets/kedro_datasets/biosequence/biosequence_dataset.py @@ -10,6 +10,7 @@ from Bio import SeqIO from kedro.io.core import get_filepath_str, get_protocol_and_path +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractDataset @@ -150,7 +151,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/dask/parquet_dataset.py b/kedro-datasets/kedro_datasets/dask/parquet_dataset.py index 9900e1a19..5ec39fed5 100644 --- a/kedro-datasets/kedro_datasets/dask/parquet_dataset.py +++ b/kedro-datasets/kedro_datasets/dask/parquet_dataset.py @@ -9,6 +9,7 @@ import triad from kedro.io.core import get_protocol_and_path +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractDataset @@ -222,7 +223,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/databricks/managed_table_dataset.py b/kedro-datasets/kedro_datasets/databricks/managed_table_dataset.py index e2e847484..33c7ef1d1 100644 --- a/kedro-datasets/kedro_datasets/databricks/managed_table_dataset.py +++ b/kedro-datasets/kedro_datasets/databricks/managed_table_dataset.py @@ -13,6 +13,7 @@ from pyspark.sql.types import StructType from pyspark.sql.utils import AnalysisException, ParseException +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractVersionedDataset, DatasetError logger = logging.getLogger(__name__) @@ -450,7 +451,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/email/message_dataset.py b/kedro-datasets/kedro_datasets/email/message_dataset.py index b81dc7804..1f45042fd 100644 --- a/kedro-datasets/kedro_datasets/email/message_dataset.py +++ b/kedro-datasets/kedro_datasets/email/message_dataset.py @@ -14,6 +14,7 @@ import fsspec from kedro.io.core import Version, get_filepath_str, get_protocol_and_path +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractVersionedDataset, DatasetError @@ -193,7 +194,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/geopandas/geojson_dataset.py b/kedro-datasets/kedro_datasets/geopandas/geojson_dataset.py index 3c5807b9a..56a8890a7 100644 --- a/kedro-datasets/kedro_datasets/geopandas/geojson_dataset.py +++ b/kedro-datasets/kedro_datasets/geopandas/geojson_dataset.py @@ -11,6 +11,7 @@ import geopandas as gpd from kedro.io.core import Version, get_filepath_str, get_protocol_and_path +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractVersionedDataset, DatasetError @@ -164,7 +165,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/json/json_dataset.py b/kedro-datasets/kedro_datasets/json/json_dataset.py index 6cae55cce..341e13933 100644 --- a/kedro-datasets/kedro_datasets/json/json_dataset.py +++ b/kedro-datasets/kedro_datasets/json/json_dataset.py @@ -10,6 +10,7 @@ import fsspec from kedro.io.core import Version, get_filepath_str, get_protocol_and_path +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractVersionedDataset, DatasetError @@ -167,7 +168,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/networkx/gml_dataset.py b/kedro-datasets/kedro_datasets/networkx/gml_dataset.py index cc7d21bf0..f4d63e87e 100644 --- a/kedro-datasets/kedro_datasets/networkx/gml_dataset.py +++ b/kedro-datasets/kedro_datasets/networkx/gml_dataset.py @@ -11,6 +11,7 @@ import networkx from kedro.io.core import Version, get_filepath_str, get_protocol_and_path +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractVersionedDataset @@ -152,7 +153,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/networkx/graphml_dataset.py b/kedro-datasets/kedro_datasets/networkx/graphml_dataset.py index 902b29114..0a368f505 100644 --- a/kedro-datasets/kedro_datasets/networkx/graphml_dataset.py +++ b/kedro-datasets/kedro_datasets/networkx/graphml_dataset.py @@ -10,6 +10,7 @@ import networkx from kedro.io.core import Version, get_filepath_str, get_protocol_and_path +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractVersionedDataset @@ -150,7 +151,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/networkx/json_dataset.py b/kedro-datasets/kedro_datasets/networkx/json_dataset.py index 3d565003d..4a41f9a67 100644 --- a/kedro-datasets/kedro_datasets/networkx/json_dataset.py +++ b/kedro-datasets/kedro_datasets/networkx/json_dataset.py @@ -11,6 +11,7 @@ import networkx from kedro.io.core import Version, get_filepath_str, get_protocol_and_path +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractVersionedDataset @@ -157,7 +158,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/pandas/csv_dataset.py b/kedro-datasets/kedro_datasets/pandas/csv_dataset.py index 4887968cd..543035238 100644 --- a/kedro-datasets/kedro_datasets/pandas/csv_dataset.py +++ b/kedro-datasets/kedro_datasets/pandas/csv_dataset.py @@ -17,6 +17,7 @@ get_protocol_and_path, ) +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractVersionedDataset, DatasetError logger = logging.getLogger(__name__) @@ -214,7 +215,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/pandas/deltatable_dataset.py b/kedro-datasets/kedro_datasets/pandas/deltatable_dataset.py index 9df340c6d..4581312c5 100644 --- a/kedro-datasets/kedro_datasets/pandas/deltatable_dataset.py +++ b/kedro-datasets/kedro_datasets/pandas/deltatable_dataset.py @@ -11,6 +11,7 @@ from deltalake.exceptions import TableNotFoundError from deltalake.writer import write_deltalake +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractDataset, DatasetError @@ -271,7 +272,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/pandas/excel_dataset.py b/kedro-datasets/kedro_datasets/pandas/excel_dataset.py index 181e6cd71..6f4b0ff27 100644 --- a/kedro-datasets/kedro_datasets/pandas/excel_dataset.py +++ b/kedro-datasets/kedro_datasets/pandas/excel_dataset.py @@ -17,6 +17,7 @@ get_protocol_and_path, ) +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractVersionedDataset, DatasetError logger = logging.getLogger(__name__) @@ -282,7 +283,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/pandas/feather_dataset.py b/kedro-datasets/kedro_datasets/pandas/feather_dataset.py index 45a454dcf..41995dda4 100644 --- a/kedro-datasets/kedro_datasets/pandas/feather_dataset.py +++ b/kedro-datasets/kedro_datasets/pandas/feather_dataset.py @@ -18,6 +18,7 @@ get_protocol_and_path, ) +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractVersionedDataset logger = logging.getLogger(__name__) @@ -202,7 +203,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/pandas/gbq_dataset.py b/kedro-datasets/kedro_datasets/pandas/gbq_dataset.py index 8dba87dd8..d672cae0c 100644 --- a/kedro-datasets/kedro_datasets/pandas/gbq_dataset.py +++ b/kedro-datasets/kedro_datasets/pandas/gbq_dataset.py @@ -17,6 +17,7 @@ validate_on_forbidden_chars, ) +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractDataset, DatasetError @@ -330,7 +331,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/pandas/generic_dataset.py b/kedro-datasets/kedro_datasets/pandas/generic_dataset.py index d9395b8e8..987d79be7 100644 --- a/kedro-datasets/kedro_datasets/pandas/generic_dataset.py +++ b/kedro-datasets/kedro_datasets/pandas/generic_dataset.py @@ -11,6 +11,7 @@ import pandas as pd from kedro.io.core import Version, get_filepath_str, get_protocol_and_path +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractVersionedDataset, DatasetError NON_FILE_SYSTEM_TARGETS = [ @@ -252,7 +253,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/pandas/hdf_dataset.py b/kedro-datasets/kedro_datasets/pandas/hdf_dataset.py index 50d33e460..73870e56a 100644 --- a/kedro-datasets/kedro_datasets/pandas/hdf_dataset.py +++ b/kedro-datasets/kedro_datasets/pandas/hdf_dataset.py @@ -11,6 +11,7 @@ import pandas as pd from kedro.io.core import Version, get_filepath_str, get_protocol_and_path +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractVersionedDataset, DatasetError HDFSTORE_DRIVER = "H5FD_CORE" @@ -212,7 +213,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/pandas/json_dataset.py b/kedro-datasets/kedro_datasets/pandas/json_dataset.py index 91dd2930d..f480f0754 100644 --- a/kedro-datasets/kedro_datasets/pandas/json_dataset.py +++ b/kedro-datasets/kedro_datasets/pandas/json_dataset.py @@ -17,6 +17,7 @@ get_protocol_and_path, ) +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractVersionedDataset, DatasetError logger = logging.getLogger(__name__) @@ -200,7 +201,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/pandas/parquet_dataset.py b/kedro-datasets/kedro_datasets/pandas/parquet_dataset.py index dc4c05618..b132d69b3 100644 --- a/kedro-datasets/kedro_datasets/pandas/parquet_dataset.py +++ b/kedro-datasets/kedro_datasets/pandas/parquet_dataset.py @@ -17,6 +17,7 @@ get_protocol_and_path, ) +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractVersionedDataset, DatasetError logger = logging.getLogger(__name__) @@ -226,7 +227,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/pandas/sql_dataset.py b/kedro-datasets/kedro_datasets/pandas/sql_dataset.py index 59feb51b4..beb25fb3f 100644 --- a/kedro-datasets/kedro_datasets/pandas/sql_dataset.py +++ b/kedro-datasets/kedro_datasets/pandas/sql_dataset.py @@ -12,6 +12,7 @@ from sqlalchemy import create_engine, inspect from sqlalchemy.exc import NoSuchModuleError +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractDataset, DatasetError __all__ = ["SQLTableDataset", "SQLQueryDataset"] @@ -547,7 +548,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/pandas/xml_dataset.py b/kedro-datasets/kedro_datasets/pandas/xml_dataset.py index 129d5e3fb..fa3fe1de4 100644 --- a/kedro-datasets/kedro_datasets/pandas/xml_dataset.py +++ b/kedro-datasets/kedro_datasets/pandas/xml_dataset.py @@ -17,6 +17,7 @@ get_protocol_and_path, ) +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractVersionedDataset, DatasetError logger = logging.getLogger(__name__) @@ -184,7 +185,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/pickle/pickle_dataset.py b/kedro-datasets/kedro_datasets/pickle/pickle_dataset.py index 19f8072a0..b28103e7e 100644 --- a/kedro-datasets/kedro_datasets/pickle/pickle_dataset.py +++ b/kedro-datasets/kedro_datasets/pickle/pickle_dataset.py @@ -12,6 +12,7 @@ import fsspec from kedro.io.core import Version, get_filepath_str, get_protocol_and_path +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractVersionedDataset, DatasetError @@ -252,7 +253,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/pillow/image_dataset.py b/kedro-datasets/kedro_datasets/pillow/image_dataset.py index 91bae8842..161ff9dc5 100644 --- a/kedro-datasets/kedro_datasets/pillow/image_dataset.py +++ b/kedro-datasets/kedro_datasets/pillow/image_dataset.py @@ -10,6 +10,7 @@ from kedro.io.core import Version, get_filepath_str, get_protocol_and_path from PIL import Image +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractVersionedDataset, DatasetError @@ -160,7 +161,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/plotly/json_dataset.py b/kedro-datasets/kedro_datasets/plotly/json_dataset.py index b21f4f9bc..68e5ad9a5 100644 --- a/kedro-datasets/kedro_datasets/plotly/json_dataset.py +++ b/kedro-datasets/kedro_datasets/plotly/json_dataset.py @@ -11,6 +11,7 @@ from kedro.io.core import Version, get_filepath_str, get_protocol_and_path from plotly import graph_objects as go +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractVersionedDataset @@ -176,7 +177,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/plotly/plotly_dataset.py b/kedro-datasets/kedro_datasets/plotly/plotly_dataset.py index 985588e0a..a30e62f0d 100644 --- a/kedro-datasets/kedro_datasets/plotly/plotly_dataset.py +++ b/kedro-datasets/kedro_datasets/plotly/plotly_dataset.py @@ -11,7 +11,8 @@ from kedro.io.core import Version from plotly import graph_objects as go -from .json_dataset import JSONDataset +from kedro_datasets import KedroDeprecationWarning +from kedro_datasets.plotly.json_dataset import JSONDataset class PlotlyDataset(JSONDataset): @@ -153,7 +154,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/polars/csv_dataset.py b/kedro-datasets/kedro_datasets/polars/csv_dataset.py index 0e87c2bb2..e2638107f 100644 --- a/kedro-datasets/kedro_datasets/polars/csv_dataset.py +++ b/kedro-datasets/kedro_datasets/polars/csv_dataset.py @@ -17,6 +17,7 @@ get_protocol_and_path, ) +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractVersionedDataset, DatasetError logger = logging.getLogger(__name__) @@ -207,7 +208,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/polars/generic_dataset.py b/kedro-datasets/kedro_datasets/polars/generic_dataset.py index 8b790e456..5deceff44 100644 --- a/kedro-datasets/kedro_datasets/polars/generic_dataset.py +++ b/kedro-datasets/kedro_datasets/polars/generic_dataset.py @@ -12,6 +12,7 @@ import polars as pl from kedro.io.core import Version, get_filepath_str, get_protocol_and_path +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractVersionedDataset, DatasetError @@ -209,7 +210,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/redis/redis_dataset.py b/kedro-datasets/kedro_datasets/redis/redis_dataset.py index dc04de00e..770ee98af 100644 --- a/kedro-datasets/kedro_datasets/redis/redis_dataset.py +++ b/kedro-datasets/kedro_datasets/redis/redis_dataset.py @@ -9,6 +9,7 @@ import redis +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractDataset, DatasetError @@ -202,7 +203,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/snowflake/snowpark_dataset.py b/kedro-datasets/kedro_datasets/snowflake/snowpark_dataset.py index d98ef2dd6..6fbfa60a0 100644 --- a/kedro-datasets/kedro_datasets/snowflake/snowpark_dataset.py +++ b/kedro-datasets/kedro_datasets/snowflake/snowpark_dataset.py @@ -7,6 +7,7 @@ import snowflake.snowpark as sp +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractDataset, DatasetError logger = logging.getLogger(__name__) @@ -255,7 +256,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/spark/deltatable_dataset.py b/kedro-datasets/kedro_datasets/spark/deltatable_dataset.py index 7df0c411a..f1b6a74b5 100644 --- a/kedro-datasets/kedro_datasets/spark/deltatable_dataset.py +++ b/kedro-datasets/kedro_datasets/spark/deltatable_dataset.py @@ -9,6 +9,7 @@ from pyspark.sql import SparkSession from pyspark.sql.utils import AnalysisException +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractDataset, DatasetError from kedro_datasets.spark.spark_dataset import _split_filepath, _strip_dbfs_prefix @@ -120,7 +121,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/spark/spark_dataset.py b/kedro-datasets/kedro_datasets/spark/spark_dataset.py index 5971ba495..221e4e562 100644 --- a/kedro-datasets/kedro_datasets/spark/spark_dataset.py +++ b/kedro-datasets/kedro_datasets/spark/spark_dataset.py @@ -20,6 +20,7 @@ from pyspark.sql.utils import AnalysisException from s3fs import S3FileSystem +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractVersionedDataset, DatasetError logger = logging.getLogger(__name__) @@ -439,7 +440,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/spark/spark_hive_dataset.py b/kedro-datasets/kedro_datasets/spark/spark_hive_dataset.py index 860855719..33cc31f02 100644 --- a/kedro-datasets/kedro_datasets/spark/spark_hive_dataset.py +++ b/kedro-datasets/kedro_datasets/spark/spark_hive_dataset.py @@ -9,6 +9,7 @@ from pyspark.sql import DataFrame, SparkSession, Window from pyspark.sql.functions import col, lit, row_number +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractDataset, DatasetError @@ -233,7 +234,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/spark/spark_jdbc_dataset.py b/kedro-datasets/kedro_datasets/spark/spark_jdbc_dataset.py index c062a6a70..18af44546 100644 --- a/kedro-datasets/kedro_datasets/spark/spark_jdbc_dataset.py +++ b/kedro-datasets/kedro_datasets/spark/spark_jdbc_dataset.py @@ -5,6 +5,7 @@ from pyspark.sql import DataFrame, SparkSession +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractDataset, DatasetError @@ -187,7 +188,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/spark/spark_streaming_dataset.py b/kedro-datasets/kedro_datasets/spark/spark_streaming_dataset.py index 4e02a4c13..7ebe84ae4 100644 --- a/kedro-datasets/kedro_datasets/spark/spark_streaming_dataset.py +++ b/kedro-datasets/kedro_datasets/spark/spark_streaming_dataset.py @@ -7,6 +7,7 @@ from pyspark.sql import DataFrame, SparkSession from pyspark.sql.utils import AnalysisException +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractDataset from kedro_datasets.spark.spark_dataset import ( SparkDataset, @@ -171,7 +172,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/svmlight/svmlight_dataset.py b/kedro-datasets/kedro_datasets/svmlight/svmlight_dataset.py index 2ea1b3be7..05edae8a6 100644 --- a/kedro-datasets/kedro_datasets/svmlight/svmlight_dataset.py +++ b/kedro-datasets/kedro_datasets/svmlight/svmlight_dataset.py @@ -13,6 +13,7 @@ from scipy.sparse.csr import csr_matrix from sklearn.datasets import dump_svmlight_file, load_svmlight_file +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractVersionedDataset, DatasetError # NOTE: kedro.extras.datasets will be removed in Kedro 0.19.0. @@ -202,7 +203,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/tensorflow/tensorflow_model_dataset.py b/kedro-datasets/kedro_datasets/tensorflow/tensorflow_model_dataset.py index 18b4274c7..a95b1bfa2 100644 --- a/kedro-datasets/kedro_datasets/tensorflow/tensorflow_model_dataset.py +++ b/kedro-datasets/kedro_datasets/tensorflow/tensorflow_model_dataset.py @@ -11,6 +11,7 @@ import tensorflow as tf from kedro.io.core import Version, get_filepath_str, get_protocol_and_path +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractVersionedDataset, DatasetError TEMPORARY_H5_FILE = "tmp_tensorflow_model.h5" @@ -200,7 +201,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/text/text_dataset.py b/kedro-datasets/kedro_datasets/text/text_dataset.py index 2c1ecff6f..a6d9be17e 100644 --- a/kedro-datasets/kedro_datasets/text/text_dataset.py +++ b/kedro-datasets/kedro_datasets/text/text_dataset.py @@ -9,6 +9,7 @@ import fsspec from kedro.io.core import Version, get_filepath_str, get_protocol_and_path +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractVersionedDataset, DatasetError @@ -151,7 +152,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/tracking/json_dataset.py b/kedro-datasets/kedro_datasets/tracking/json_dataset.py index 8dac0fc4d..943e686fd 100644 --- a/kedro-datasets/kedro_datasets/tracking/json_dataset.py +++ b/kedro-datasets/kedro_datasets/tracking/json_dataset.py @@ -7,6 +7,7 @@ from kedro.io.core import DatasetError +from kedro_datasets import KedroDeprecationWarning from kedro_datasets.json import json_dataset @@ -57,7 +58,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/tracking/metrics_dataset.py b/kedro-datasets/kedro_datasets/tracking/metrics_dataset.py index 9e05855fa..cfd30d1a4 100644 --- a/kedro-datasets/kedro_datasets/tracking/metrics_dataset.py +++ b/kedro-datasets/kedro_datasets/tracking/metrics_dataset.py @@ -9,6 +9,7 @@ from kedro.io.core import DatasetError, get_filepath_str +from kedro_datasets import KedroDeprecationWarning from kedro_datasets.json import json_dataset @@ -78,7 +79,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/video/video_dataset.py b/kedro-datasets/kedro_datasets/video/video_dataset.py index b85fc1231..de97d7b8e 100644 --- a/kedro-datasets/kedro_datasets/video/video_dataset.py +++ b/kedro-datasets/kedro_datasets/video/video_dataset.py @@ -16,6 +16,7 @@ import PIL.Image from kedro.io.core import get_protocol_and_path +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractDataset @@ -376,7 +377,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/kedro_datasets/yaml/yaml_dataset.py b/kedro-datasets/kedro_datasets/yaml/yaml_dataset.py index 45350b338..d9aa536fb 100644 --- a/kedro-datasets/kedro_datasets/yaml/yaml_dataset.py +++ b/kedro-datasets/kedro_datasets/yaml/yaml_dataset.py @@ -10,6 +10,7 @@ import yaml from kedro.io.core import Version, get_filepath_str, get_protocol_and_path +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import AbstractVersionedDataset, DatasetError @@ -163,7 +164,7 @@ def __getattr__(name): warnings.warn( f"{repr(name)} has been renamed to {repr(alias.__name__)}, " f"and the alias will be removed in Kedro-Datasets 2.0.0", - DeprecationWarning, + KedroDeprecationWarning, stacklevel=2, ) return alias diff --git a/kedro-datasets/tests/api/test_api_dataset.py b/kedro-datasets/tests/api/test_api_dataset.py index 10a0baf6d..e0ac4af93 100644 --- a/kedro-datasets/tests/api/test_api_dataset.py +++ b/kedro-datasets/tests/api/test_api_dataset.py @@ -8,6 +8,7 @@ import requests from requests.auth import HTTPBasicAuth +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.api import APIDataset from kedro_datasets.api.api_dataset import _DEPRECATED_CLASSES @@ -33,7 +34,9 @@ ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/biosequence/test_biosequence_dataset.py b/kedro-datasets/tests/biosequence/test_biosequence_dataset.py index d429dd420..3ee151f7d 100644 --- a/kedro-datasets/tests/biosequence/test_biosequence_dataset.py +++ b/kedro-datasets/tests/biosequence/test_biosequence_dataset.py @@ -10,6 +10,7 @@ from kedro.io.core import PROTOCOL_DELIMITER from s3fs.core import S3FileSystem +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.biosequence import BioSequenceDataset from kedro_datasets.biosequence.biosequence_dataset import _DEPRECATED_CLASSES @@ -45,7 +46,9 @@ def dummy_data(): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/dask/test_parquet_dataset.py b/kedro-datasets/tests/dask/test_parquet_dataset.py index 08c753f59..255c2717a 100644 --- a/kedro-datasets/tests/dask/test_parquet_dataset.py +++ b/kedro-datasets/tests/dask/test_parquet_dataset.py @@ -10,6 +10,7 @@ from pandas.testing import assert_frame_equal from s3fs import S3FileSystem +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.dask import ParquetDataset from kedro_datasets.dask.parquet_dataset import _DEPRECATED_CLASSES @@ -79,7 +80,9 @@ def s3fs_cleanup(): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/databricks/test_managed_table_dataset.py b/kedro-datasets/tests/databricks/test_managed_table_dataset.py index dc2595740..929021a9e 100644 --- a/kedro-datasets/tests/databricks/test_managed_table_dataset.py +++ b/kedro-datasets/tests/databricks/test_managed_table_dataset.py @@ -6,6 +6,7 @@ from pyspark.sql import DataFrame, SparkSession from pyspark.sql.types import IntegerType, StringType, StructField, StructType +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.databricks import ManagedTableDataset from kedro_datasets.databricks.managed_table_dataset import _DEPRECATED_CLASSES @@ -179,7 +180,9 @@ def expected_upsert_multiple_primary_spark_df(spark_session: SparkSession): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/email/test_message_dataset.py b/kedro-datasets/tests/email/test_message_dataset.py index bb65304df..423741c9c 100644 --- a/kedro-datasets/tests/email/test_message_dataset.py +++ b/kedro-datasets/tests/email/test_message_dataset.py @@ -10,6 +10,7 @@ from kedro.io.core import PROTOCOL_DELIMITER, Version from s3fs.core import S3FileSystem +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.email import EmailMessageDataset from kedro_datasets.email.message_dataset import _DEPRECATED_CLASSES @@ -56,7 +57,9 @@ def dummy_msg(): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/geopandas/test_geojson_dataset.py b/kedro-datasets/tests/geopandas/test_geojson_dataset.py index 42131f1f4..0bf32552a 100644 --- a/kedro-datasets/tests/geopandas/test_geojson_dataset.py +++ b/kedro-datasets/tests/geopandas/test_geojson_dataset.py @@ -11,6 +11,7 @@ from s3fs import S3FileSystem from shapely.geometry import Point +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.geopandas import GeoJSONDataset from kedro_datasets.geopandas.geojson_dataset import _DEPRECATED_CLASSES @@ -69,7 +70,9 @@ def versioned_geojson_dataset(filepath, load_version, save_version): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/json/test_json_dataset.py b/kedro-datasets/tests/json/test_json_dataset.py index 6fae0f9ef..e88ac689a 100644 --- a/kedro-datasets/tests/json/test_json_dataset.py +++ b/kedro-datasets/tests/json/test_json_dataset.py @@ -8,6 +8,7 @@ from kedro.io.core import PROTOCOL_DELIMITER, Version from s3fs.core import S3FileSystem +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.json import JSONDataset from kedro_datasets.json.json_dataset import _DEPRECATED_CLASSES @@ -40,7 +41,9 @@ def dummy_data(): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/networkx/test_gml_dataset.py b/kedro-datasets/tests/networkx/test_gml_dataset.py index 903e2019e..5fe193a57 100644 --- a/kedro-datasets/tests/networkx/test_gml_dataset.py +++ b/kedro-datasets/tests/networkx/test_gml_dataset.py @@ -10,6 +10,7 @@ from kedro.io.core import PROTOCOL_DELIMITER from s3fs.core import S3FileSystem +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.networkx import GMLDataset from kedro_datasets.networkx.gml_dataset import _DEPRECATED_CLASSES @@ -57,7 +58,9 @@ def dummy_graph_data(): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/networkx/test_graphml_dataset.py b/kedro-datasets/tests/networkx/test_graphml_dataset.py index 69e6269f5..5c60beee7 100644 --- a/kedro-datasets/tests/networkx/test_graphml_dataset.py +++ b/kedro-datasets/tests/networkx/test_graphml_dataset.py @@ -10,6 +10,7 @@ from kedro.io.core import PROTOCOL_DELIMITER from s3fs.core import S3FileSystem +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.networkx import GraphMLDataset from kedro_datasets.networkx.graphml_dataset import _DEPRECATED_CLASSES @@ -58,7 +59,9 @@ def dummy_graph_data(): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/networkx/test_json_dataset.py b/kedro-datasets/tests/networkx/test_json_dataset.py index 91b221e0a..e649bc1fb 100644 --- a/kedro-datasets/tests/networkx/test_json_dataset.py +++ b/kedro-datasets/tests/networkx/test_json_dataset.py @@ -10,6 +10,7 @@ from kedro.io.core import PROTOCOL_DELIMITER from s3fs.core import S3FileSystem +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.networkx import JSONDataset from kedro_datasets.networkx.json_dataset import _DEPRECATED_CLASSES @@ -57,7 +58,9 @@ def dummy_graph_data(): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/pandas/test_csv_dataset.py b/kedro-datasets/tests/pandas/test_csv_dataset.py index 623d1cf29..5364ff19c 100644 --- a/kedro-datasets/tests/pandas/test_csv_dataset.py +++ b/kedro-datasets/tests/pandas/test_csv_dataset.py @@ -16,6 +16,7 @@ from pandas.testing import assert_frame_equal from s3fs.core import S3FileSystem +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.pandas import CSVDataset from kedro_datasets.pandas.csv_dataset import _DEPRECATED_CLASSES @@ -92,7 +93,9 @@ def mocked_csv_in_s3(mocked_s3_bucket, mocked_dataframe): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/pandas/test_deltatable_dataset.py b/kedro-datasets/tests/pandas/test_deltatable_dataset.py index 9665f7e36..eaed4b4fe 100644 --- a/kedro-datasets/tests/pandas/test_deltatable_dataset.py +++ b/kedro-datasets/tests/pandas/test_deltatable_dataset.py @@ -5,6 +5,7 @@ from deltalake import DataCatalog, Metadata from pandas.testing import assert_frame_equal +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.pandas import DeltaTableDataset from kedro_datasets.pandas.deltatable_dataset import _DEPRECATED_CLASSES @@ -35,7 +36,9 @@ def deltatable_dataset_from_path(filepath, load_args, save_args, fs_args): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/pandas/test_excel_dataset.py b/kedro-datasets/tests/pandas/test_excel_dataset.py index 9a299028c..a80a299b0 100644 --- a/kedro-datasets/tests/pandas/test_excel_dataset.py +++ b/kedro-datasets/tests/pandas/test_excel_dataset.py @@ -10,6 +10,7 @@ from pandas.testing import assert_frame_equal from s3fs.core import S3FileSystem +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.pandas import ExcelDataset from kedro_datasets.pandas.excel_dataset import _DEPRECATED_CLASSES @@ -63,7 +64,9 @@ def another_dummy_dataframe(): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/pandas/test_feather_dataset.py b/kedro-datasets/tests/pandas/test_feather_dataset.py index e2903aefc..66eef5b88 100644 --- a/kedro-datasets/tests/pandas/test_feather_dataset.py +++ b/kedro-datasets/tests/pandas/test_feather_dataset.py @@ -10,6 +10,7 @@ from pandas.testing import assert_frame_equal from s3fs.core import S3FileSystem +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.pandas import FeatherDataset from kedro_datasets.pandas.feather_dataset import _DEPRECATED_CLASSES @@ -44,7 +45,9 @@ def dummy_dataframe(): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/pandas/test_gbq_dataset.py b/kedro-datasets/tests/pandas/test_gbq_dataset.py index be4d65942..d340c5a7d 100644 --- a/kedro-datasets/tests/pandas/test_gbq_dataset.py +++ b/kedro-datasets/tests/pandas/test_gbq_dataset.py @@ -6,6 +6,7 @@ from google.cloud.exceptions import NotFound from pandas.testing import assert_frame_equal +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.pandas import GBQQueryDataset, GBQTableDataset from kedro_datasets.pandas.gbq_dataset import _DEPRECATED_CLASSES @@ -71,7 +72,9 @@ def gbq_sql_file_dataset(load_args, sql_file, mock_bigquery_client): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/pandas/test_generic_dataset.py b/kedro-datasets/tests/pandas/test_generic_dataset.py index 8cacaa5bc..817d98720 100644 --- a/kedro-datasets/tests/pandas/test_generic_dataset.py +++ b/kedro-datasets/tests/pandas/test_generic_dataset.py @@ -13,6 +13,7 @@ from pandas._testing import assert_frame_equal from s3fs import S3FileSystem +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.pandas import GenericDataset from kedro_datasets.pandas.generic_dataset import _DEPRECATED_CLASSES @@ -97,7 +98,9 @@ def dummy_dataframe(): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/pandas/test_hdf_dataset.py b/kedro-datasets/tests/pandas/test_hdf_dataset.py index 74b3fee86..c43528e6a 100644 --- a/kedro-datasets/tests/pandas/test_hdf_dataset.py +++ b/kedro-datasets/tests/pandas/test_hdf_dataset.py @@ -10,6 +10,7 @@ from pandas.testing import assert_frame_equal from s3fs.core import S3FileSystem +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.pandas import HDFDataset from kedro_datasets.pandas.hdf_dataset import _DEPRECATED_CLASSES @@ -51,7 +52,9 @@ def dummy_dataframe(): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/pandas/test_json_dataset.py b/kedro-datasets/tests/pandas/test_json_dataset.py index 0b246b3fe..e20366eaf 100644 --- a/kedro-datasets/tests/pandas/test_json_dataset.py +++ b/kedro-datasets/tests/pandas/test_json_dataset.py @@ -11,6 +11,7 @@ from pandas.testing import assert_frame_equal from s3fs.core import S3FileSystem +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.pandas import JSONDataset from kedro_datasets.pandas.json_dataset import _DEPRECATED_CLASSES @@ -48,7 +49,9 @@ def dummy_dataframe(): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/pandas/test_parquet_dataset.py b/kedro-datasets/tests/pandas/test_parquet_dataset.py index 64a497725..83f0695fb 100644 --- a/kedro-datasets/tests/pandas/test_parquet_dataset.py +++ b/kedro-datasets/tests/pandas/test_parquet_dataset.py @@ -11,6 +11,7 @@ from pyarrow.fs import FSSpecHandler, PyFileSystem from s3fs.core import S3FileSystem +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.pandas import ParquetDataset from kedro_datasets.pandas.parquet_dataset import _DEPRECATED_CLASSES @@ -50,7 +51,9 @@ def dummy_dataframe(): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/pandas/test_sql_dataset.py b/kedro-datasets/tests/pandas/test_sql_dataset.py index 26f7e0bd4..a90cff0b7 100644 --- a/kedro-datasets/tests/pandas/test_sql_dataset.py +++ b/kedro-datasets/tests/pandas/test_sql_dataset.py @@ -6,6 +6,7 @@ import pytest import sqlalchemy +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.pandas import SQLQueryDataset, SQLTableDataset from kedro_datasets.pandas.sql_dataset import _DEPRECATED_CLASSES @@ -66,7 +67,9 @@ def query_file_dataset(request, sql_file): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/pandas/test_xml_dataset.py b/kedro-datasets/tests/pandas/test_xml_dataset.py index 9a54174e4..345dfcdbd 100644 --- a/kedro-datasets/tests/pandas/test_xml_dataset.py +++ b/kedro-datasets/tests/pandas/test_xml_dataset.py @@ -11,6 +11,7 @@ from pandas.testing import assert_frame_equal from s3fs.core import S3FileSystem +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.pandas import XMLDataset from kedro_datasets.pandas.xml_dataset import _DEPRECATED_CLASSES @@ -48,7 +49,9 @@ def dummy_dataframe(): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/pickle/test_pickle_dataset.py b/kedro-datasets/tests/pickle/test_pickle_dataset.py index 4cc547e90..be09d6291 100644 --- a/kedro-datasets/tests/pickle/test_pickle_dataset.py +++ b/kedro-datasets/tests/pickle/test_pickle_dataset.py @@ -11,6 +11,7 @@ from pandas.testing import assert_frame_equal from s3fs.core import S3FileSystem +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.pickle import PickleDataset from kedro_datasets.pickle.pickle_dataset import _DEPRECATED_CLASSES @@ -54,7 +55,9 @@ def dummy_dataframe(): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/pillow/test_image_dataset.py b/kedro-datasets/tests/pillow/test_image_dataset.py index e2c970835..8ce6bf825 100644 --- a/kedro-datasets/tests/pillow/test_image_dataset.py +++ b/kedro-datasets/tests/pillow/test_image_dataset.py @@ -9,6 +9,7 @@ from PIL import Image, ImageChops from s3fs.core import S3FileSystem +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.pillow import ImageDataset from kedro_datasets.pillow.image_dataset import _DEPRECATED_CLASSES @@ -47,7 +48,9 @@ def images_equal(image_1, image_2): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/plotly/test_json_dataset.py b/kedro-datasets/tests/plotly/test_json_dataset.py index 52cda8d07..2525a9a73 100644 --- a/kedro-datasets/tests/plotly/test_json_dataset.py +++ b/kedro-datasets/tests/plotly/test_json_dataset.py @@ -10,6 +10,7 @@ from kedro.io.core import PROTOCOL_DELIMITER from s3fs.core import S3FileSystem +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.plotly import JSONDataset from kedro_datasets.plotly.json_dataset import _DEPRECATED_CLASSES @@ -40,7 +41,9 @@ def dummy_plot(): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/plotly/test_plotly_dataset.py b/kedro-datasets/tests/plotly/test_plotly_dataset.py index 9a7c9d3a1..4f43b34ee 100644 --- a/kedro-datasets/tests/plotly/test_plotly_dataset.py +++ b/kedro-datasets/tests/plotly/test_plotly_dataset.py @@ -12,6 +12,7 @@ from plotly.graph_objs import Scatter from s3fs.core import S3FileSystem +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.plotly import PlotlyDataset from kedro_datasets.plotly.plotly_dataset import _DEPRECATED_CLASSES @@ -52,7 +53,9 @@ def dummy_dataframe(): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/polars/test_csv_dataset.py b/kedro-datasets/tests/polars/test_csv_dataset.py index e0519dd46..9226a89a1 100644 --- a/kedro-datasets/tests/polars/test_csv_dataset.py +++ b/kedro-datasets/tests/polars/test_csv_dataset.py @@ -16,6 +16,7 @@ from polars.testing import assert_frame_equal from s3fs.core import S3FileSystem +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.polars import CSVDataset from kedro_datasets.polars.csv_dataset import _DEPRECATED_CLASSES @@ -95,7 +96,9 @@ def mocked_csv_in_s3(mocked_s3_bucket, mocked_dataframe: pl.DataFrame): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/polars/test_generic_dataset.py b/kedro-datasets/tests/polars/test_generic_dataset.py index 2c7769b14..b300cfd78 100644 --- a/kedro-datasets/tests/polars/test_generic_dataset.py +++ b/kedro-datasets/tests/polars/test_generic_dataset.py @@ -14,6 +14,7 @@ from polars.testing import assert_frame_equal from s3fs import S3FileSystem +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.polars import GenericDataset from kedro_datasets.polars.generic_dataset import _DEPRECATED_CLASSES @@ -109,7 +110,9 @@ def excel_dataset(dummy_dataframe: pl.DataFrame, filepath_excel): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/redis/test_redis_dataset.py b/kedro-datasets/tests/redis/test_redis_dataset.py index 8b879edd6..a2ec3bf83 100644 --- a/kedro-datasets/tests/redis/test_redis_dataset.py +++ b/kedro-datasets/tests/redis/test_redis_dataset.py @@ -8,6 +8,7 @@ import redis from pandas.testing import assert_frame_equal +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.redis import PickleDataset from kedro_datasets.redis.redis_dataset import _DEPRECATED_CLASSES @@ -63,7 +64,9 @@ def pickle_data_set(mocker, key, backend, load_args, save_args, redis_args): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/snowflake/test_snowpark_dataset.py b/kedro-datasets/tests/snowflake/test_snowpark_dataset.py index 1423fbc12..4d5e473e9 100644 --- a/kedro-datasets/tests/snowflake/test_snowpark_dataset.py +++ b/kedro-datasets/tests/snowflake/test_snowpark_dataset.py @@ -4,6 +4,7 @@ import pytest +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError try: @@ -147,7 +148,9 @@ def sf_session(): @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) @pytest.mark.snowflake def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/spark/test_deltatable_dataset.py b/kedro-datasets/tests/spark/test_deltatable_dataset.py index cc2d57adc..58940f5ce 100644 --- a/kedro-datasets/tests/spark/test_deltatable_dataset.py +++ b/kedro-datasets/tests/spark/test_deltatable_dataset.py @@ -12,6 +12,7 @@ from pyspark.sql.types import IntegerType, StringType, StructField, StructType from pyspark.sql.utils import AnalysisException +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.spark import DeltaTableDataset, SparkDataset from kedro_datasets.spark.deltatable_dataset import _DEPRECATED_CLASSES @@ -38,7 +39,9 @@ def sample_spark_df(): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/spark/test_spark_dataset.py b/kedro-datasets/tests/spark/test_spark_dataset.py index 393b401f5..7970b4ce9 100644 --- a/kedro-datasets/tests/spark/test_spark_dataset.py +++ b/kedro-datasets/tests/spark/test_spark_dataset.py @@ -26,6 +26,7 @@ ) from pyspark.sql.utils import AnalysisException +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.pandas import CSVDataset, ParquetDataset from kedro_datasets.pickle import PickleDataset @@ -177,7 +178,9 @@ def isDir(self): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/spark/test_spark_hive_dataset.py b/kedro-datasets/tests/spark/test_spark_hive_dataset.py index e33ca5cce..202d1ade8 100644 --- a/kedro-datasets/tests/spark/test_spark_hive_dataset.py +++ b/kedro-datasets/tests/spark/test_spark_hive_dataset.py @@ -10,6 +10,7 @@ from pyspark.sql import SparkSession from pyspark.sql.types import IntegerType, StringType, StructField, StructType +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.spark import SparkHiveDataset from kedro_datasets.spark.spark_hive_dataset import _DEPRECATED_CLASSES @@ -139,7 +140,9 @@ def _generate_spark_df_upsert_expected(): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/spark/test_spark_jdbc_dataset.py b/kedro-datasets/tests/spark/test_spark_jdbc_dataset.py index 9f869cf1d..e9bb33ddb 100644 --- a/kedro-datasets/tests/spark/test_spark_jdbc_dataset.py +++ b/kedro-datasets/tests/spark/test_spark_jdbc_dataset.py @@ -2,6 +2,7 @@ import pytest +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.spark import SparkJDBCDataset from kedro_datasets.spark.spark_jdbc_dataset import _DEPRECATED_CLASSES @@ -41,7 +42,9 @@ def spark_jdbc_args_save_load(spark_jdbc_args): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/spark/test_spark_streaming_dataset.py b/kedro-datasets/tests/spark/test_spark_streaming_dataset.py index cb36fb7a4..d199df812 100644 --- a/kedro-datasets/tests/spark/test_spark_streaming_dataset.py +++ b/kedro-datasets/tests/spark/test_spark_streaming_dataset.py @@ -10,6 +10,7 @@ from pyspark.sql.types import IntegerType, StringType, StructField, StructType from pyspark.sql.utils import AnalysisException +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.spark import SparkDataset, SparkStreamingDataset from kedro_datasets.spark.spark_streaming_dataset import _DEPRECATED_CLASSES @@ -96,7 +97,9 @@ def mocked_s3_schema(tmp_path, mocked_s3_bucket, sample_spark_df_schema: StructT ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/svmlight/test_svmlight_dataset.py b/kedro-datasets/tests/svmlight/test_svmlight_dataset.py index c16555c8f..63596d6d5 100644 --- a/kedro-datasets/tests/svmlight/test_svmlight_dataset.py +++ b/kedro-datasets/tests/svmlight/test_svmlight_dataset.py @@ -9,6 +9,7 @@ from kedro.io.core import PROTOCOL_DELIMITER, Version from s3fs.core import S3FileSystem +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.svmlight import SVMLightDataset from kedro_datasets.svmlight.svmlight_dataset import _DEPRECATED_CLASSES @@ -46,7 +47,9 @@ def dummy_data(): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/tensorflow/test_tensorflow_model_dataset.py b/kedro-datasets/tests/tensorflow/test_tensorflow_model_dataset.py index ffeafe321..bedaf8eab 100644 --- a/kedro-datasets/tests/tensorflow/test_tensorflow_model_dataset.py +++ b/kedro-datasets/tests/tensorflow/test_tensorflow_model_dataset.py @@ -9,6 +9,7 @@ from kedro.io.core import PROTOCOL_DELIMITER, Version from s3fs import S3FileSystem +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError @@ -140,7 +141,9 @@ def call(self, inputs, training=None, mask=None): # pragma: no cover ) @pytest.mark.parametrize("class_name", ["TensorFlowModelDataSet"]) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/text/test_text_dataset.py b/kedro-datasets/tests/text/test_text_dataset.py index a6f173dfc..ae90dd343 100644 --- a/kedro-datasets/tests/text/test_text_dataset.py +++ b/kedro-datasets/tests/text/test_text_dataset.py @@ -8,6 +8,7 @@ from kedro.io.core import PROTOCOL_DELIMITER, Version from s3fs.core import S3FileSystem +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.text import TextDataset from kedro_datasets.text.text_dataset import _DEPRECATED_CLASSES @@ -37,7 +38,9 @@ def versioned_txt_dataset(filepath_txt, load_version, save_version): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/tracking/test_json_dataset.py b/kedro-datasets/tests/tracking/test_json_dataset.py index f22789469..218521349 100644 --- a/kedro-datasets/tests/tracking/test_json_dataset.py +++ b/kedro-datasets/tests/tracking/test_json_dataset.py @@ -8,6 +8,7 @@ from kedro.io.core import PROTOCOL_DELIMITER, Version from s3fs.core import S3FileSystem +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.tracking import JSONDataset from kedro_datasets.tracking.json_dataset import _DEPRECATED_CLASSES @@ -40,7 +41,9 @@ def dummy_data(): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/tracking/test_metrics_dataset.py b/kedro-datasets/tests/tracking/test_metrics_dataset.py index 2b50617e1..a78664756 100644 --- a/kedro-datasets/tests/tracking/test_metrics_dataset.py +++ b/kedro-datasets/tests/tracking/test_metrics_dataset.py @@ -8,6 +8,7 @@ from kedro.io.core import PROTOCOL_DELIMITER, Version from s3fs.core import S3FileSystem +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.tracking import MetricsDataset from kedro_datasets.tracking.metrics_dataset import _DEPRECATED_CLASSES @@ -41,7 +42,9 @@ def dummy_data(): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/video/test_video_dataset.py b/kedro-datasets/tests/video/test_video_dataset.py index 74c387889..94442aa1c 100644 --- a/kedro-datasets/tests/video/test_video_dataset.py +++ b/kedro-datasets/tests/video/test_video_dataset.py @@ -5,6 +5,7 @@ from moto import mock_s3 from utils import TEST_FPS, assert_videos_equal +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.video import VideoDataset from kedro_datasets.video.video_dataset import ( @@ -58,7 +59,9 @@ def mocked_s3_bucket(): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name) diff --git a/kedro-datasets/tests/yaml/test_yaml_dataset.py b/kedro-datasets/tests/yaml/test_yaml_dataset.py index b439d0e80..dfbc5d923 100644 --- a/kedro-datasets/tests/yaml/test_yaml_dataset.py +++ b/kedro-datasets/tests/yaml/test_yaml_dataset.py @@ -10,6 +10,7 @@ from pandas.testing import assert_frame_equal from s3fs.core import S3FileSystem +from kedro_datasets import KedroDeprecationWarning from kedro_datasets._io import DatasetError from kedro_datasets.yaml import YAMLDataset from kedro_datasets.yaml.yaml_dataset import _DEPRECATED_CLASSES @@ -42,7 +43,9 @@ def dummy_data(): ) @pytest.mark.parametrize("class_name", _DEPRECATED_CLASSES) def test_deprecation(module_name, class_name): - with pytest.warns(DeprecationWarning, match=f"{repr(class_name)} has been renamed"): + with pytest.warns( + KedroDeprecationWarning, match=f"{repr(class_name)} has been renamed" + ): getattr(importlib.import_module(module_name), class_name)