From e491c5ce5561347c03d169929c78b13b76774b81 Mon Sep 17 00:00:00 2001 From: Deepyaman Datta Date: Wed, 21 Jun 2023 11:29:25 -0400 Subject: [PATCH] test(datasets): update the "no versioning" message (#245) * docs(datasets): fix a ref to `GeoJSONLocalDataset` * Install Kedro from `refactor/rename-data-set` instead of `main` * fix(datasets): user correct error message in tests * fix(datasets): update str representation test in Spark * style(datasets): remove useless suppression * fix(datasets): use `MemoryDataset` to avoid no-member check * build: allow WIP in PR title * fix(datasets): change reference to `MemoryDataSet` * chore(datasets): trigger CI * ci: install main Kedro again * revert(datasets): undo change to docstring --- .github/workflows/validate-pr-title.yaml | 1 + .../tests/databricks/test_managed_table_dataset.py | 2 +- kedro-datasets/tests/email/test_message_dataset.py | 2 +- kedro-datasets/tests/geojson/test_geojson_dataset.py | 2 +- kedro-datasets/tests/holoviews/test_holoviews_writer.py | 2 +- kedro-datasets/tests/json/test_json_dataset.py | 2 +- kedro-datasets/tests/libsvm/test_svmlight_dataset.py | 2 +- kedro-datasets/tests/matplotlib/test_matplotlib_writer.py | 2 +- kedro-datasets/tests/pandas/test_csv_dataset.py | 2 +- kedro-datasets/tests/pandas/test_excel_dataset.py | 2 +- kedro-datasets/tests/pandas/test_feather_dataset.py | 2 +- kedro-datasets/tests/pandas/test_hdf_dataset.py | 2 +- kedro-datasets/tests/pandas/test_json_dataset.py | 2 +- kedro-datasets/tests/pandas/test_parquet_dataset.py | 2 +- kedro-datasets/tests/pandas/test_xml_dataset.py | 2 +- kedro-datasets/tests/pickle/test_pickle_dataset.py | 2 +- kedro-datasets/tests/pillow/test_image_dataset.py | 2 +- kedro-datasets/tests/polars/test_csv_dataset.py | 2 +- kedro-datasets/tests/spark/test_memory_dataset.py | 8 ++++---- .../tests/tensorflow/test_tensorflow_model_dataset.py | 2 +- kedro-datasets/tests/text/test_text_dataset.py | 2 +- kedro-datasets/tests/tracking/test_json_dataset.py | 2 +- kedro-datasets/tests/tracking/test_metrics_dataset.py | 2 +- kedro-datasets/tests/yaml/test_yaml_dataset.py | 2 +- 24 files changed, 27 insertions(+), 26 deletions(-) diff --git a/.github/workflows/validate-pr-title.yaml b/.github/workflows/validate-pr-title.yaml index b6e6fc808..c48383084 100644 --- a/.github/workflows/validate-pr-title.yaml +++ b/.github/workflows/validate-pr-title.yaml @@ -19,5 +19,6 @@ jobs: datasets docker telemetry + wip: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/kedro-datasets/tests/databricks/test_managed_table_dataset.py b/kedro-datasets/tests/databricks/test_managed_table_dataset.py index 9aae08707..c4dfce067 100644 --- a/kedro-datasets/tests/databricks/test_managed_table_dataset.py +++ b/kedro-datasets/tests/databricks/test_managed_table_dataset.py @@ -187,7 +187,7 @@ def test_full_table(self): assert unity_ds._table.full_table_location() == "`default`.`test`" with pytest.raises(TypeError): - ManagedTableDataSet() # pylint: disable=no-value-for-parameter + ManagedTableDataSet() def test_describe(self): unity_ds = ManagedTableDataSet(table="test") diff --git a/kedro-datasets/tests/email/test_message_dataset.py b/kedro-datasets/tests/email/test_message_dataset.py index 100daba52..f198322ed 100644 --- a/kedro-datasets/tests/email/test_message_dataset.py +++ b/kedro-datasets/tests/email/test_message_dataset.py @@ -198,7 +198,7 @@ def test_save_version_warning( versioned_message_data_set.save(dummy_msg) def test_http_filesystem_no_versioning(self): - pattern = r"HTTP\(s\) DataSet doesn't support versioning\." + pattern = "Versioning is not supported for HTTP protocols." with pytest.raises(DataSetError, match=pattern): EmailMessageDataSet( diff --git a/kedro-datasets/tests/geojson/test_geojson_dataset.py b/kedro-datasets/tests/geojson/test_geojson_dataset.py index b5f3ec4cb..5ebdf52d6 100644 --- a/kedro-datasets/tests/geojson/test_geojson_dataset.py +++ b/kedro-datasets/tests/geojson/test_geojson_dataset.py @@ -204,7 +204,7 @@ def test_save_version_warning( versioned_geojson_data_set.save(dummy_dataframe) def test_http_filesystem_no_versioning(self): - pattern = r"HTTP\(s\) DataSet doesn't support versioning\." + pattern = "Versioning is not supported for HTTP protocols." with pytest.raises(DataSetError, match=pattern): GeoJSONDataSet( diff --git a/kedro-datasets/tests/holoviews/test_holoviews_writer.py b/kedro-datasets/tests/holoviews/test_holoviews_writer.py index f4f91383e..a991d5002 100644 --- a/kedro-datasets/tests/holoviews/test_holoviews_writer.py +++ b/kedro-datasets/tests/holoviews/test_holoviews_writer.py @@ -167,7 +167,7 @@ def test_save_version_warning( versioned_hv_writer.save(dummy_hv_object) def test_http_filesystem_no_versioning(self): - pattern = r"HTTP\(s\) DataSet doesn't support versioning\." + pattern = "Versioning is not supported for HTTP protocols." with pytest.raises(DataSetError, match=pattern): HoloviewsWriter( diff --git a/kedro-datasets/tests/json/test_json_dataset.py b/kedro-datasets/tests/json/test_json_dataset.py index 621e51fcd..d3dbad5c4 100644 --- a/kedro-datasets/tests/json/test_json_dataset.py +++ b/kedro-datasets/tests/json/test_json_dataset.py @@ -172,7 +172,7 @@ def test_save_version_warning( versioned_json_data_set.save(dummy_data) def test_http_filesystem_no_versioning(self): - pattern = r"HTTP\(s\) DataSet doesn't support versioning\." + pattern = "Versioning is not supported for HTTP protocols." with pytest.raises(DataSetError, match=pattern): JSONDataSet( diff --git a/kedro-datasets/tests/libsvm/test_svmlight_dataset.py b/kedro-datasets/tests/libsvm/test_svmlight_dataset.py index 8fff3edd2..10b2f8f9b 100644 --- a/kedro-datasets/tests/libsvm/test_svmlight_dataset.py +++ b/kedro-datasets/tests/libsvm/test_svmlight_dataset.py @@ -186,7 +186,7 @@ def test_save_version_warning( versioned_svm_data_set.save(dummy_data) def test_http_filesystem_no_versioning(self): - pattern = r"HTTP\(s\) DataSet doesn't support versioning\." + pattern = "Versioning is not supported for HTTP protocols." with pytest.raises(DataSetError, match=pattern): SVMLightDataSet( diff --git a/kedro-datasets/tests/matplotlib/test_matplotlib_writer.py b/kedro-datasets/tests/matplotlib/test_matplotlib_writer.py index 4086e127e..ad2c6598e 100644 --- a/kedro-datasets/tests/matplotlib/test_matplotlib_writer.py +++ b/kedro-datasets/tests/matplotlib/test_matplotlib_writer.py @@ -316,7 +316,7 @@ def test_save_version_warning( versioned_plot_writer.save(mock_single_plot) def test_http_filesystem_no_versioning(self): - pattern = r"HTTP\(s\) DataSet doesn't support versioning\." + pattern = "Versioning is not supported for HTTP protocols." with pytest.raises(DataSetError, match=pattern): MatplotlibWriter( diff --git a/kedro-datasets/tests/pandas/test_csv_dataset.py b/kedro-datasets/tests/pandas/test_csv_dataset.py index 5cc1ee36b..60694c6e0 100644 --- a/kedro-datasets/tests/pandas/test_csv_dataset.py +++ b/kedro-datasets/tests/pandas/test_csv_dataset.py @@ -361,7 +361,7 @@ def test_save_version_warning( versioned_csv_data_set.save(dummy_dataframe) def test_http_filesystem_no_versioning(self): - pattern = r"HTTP\(s\) DataSet doesn't support versioning\." + pattern = "Versioning is not supported for HTTP protocols." with pytest.raises(DataSetError, match=pattern): CSVDataSet( diff --git a/kedro-datasets/tests/pandas/test_excel_dataset.py b/kedro-datasets/tests/pandas/test_excel_dataset.py index 1080cc9b6..06f865dcb 100644 --- a/kedro-datasets/tests/pandas/test_excel_dataset.py +++ b/kedro-datasets/tests/pandas/test_excel_dataset.py @@ -296,7 +296,7 @@ def test_save_version_warning( versioned_excel_data_set.save(dummy_dataframe) def test_http_filesystem_no_versioning(self): - pattern = r"HTTP\(s\) DataSet doesn't support versioning\." + pattern = "Versioning is not supported for HTTP protocols." with pytest.raises(DataSetError, match=pattern): ExcelDataSet( diff --git a/kedro-datasets/tests/pandas/test_feather_dataset.py b/kedro-datasets/tests/pandas/test_feather_dataset.py index 80c1ce678..0743364cb 100644 --- a/kedro-datasets/tests/pandas/test_feather_dataset.py +++ b/kedro-datasets/tests/pandas/test_feather_dataset.py @@ -192,7 +192,7 @@ def test_save_version_warning( versioned_feather_data_set.save(dummy_dataframe) def test_http_filesystem_no_versioning(self): - pattern = r"HTTP\(s\) DataSet doesn't support versioning\." + pattern = "Versioning is not supported for HTTP protocols." with pytest.raises(DataSetError, match=pattern): FeatherDataSet( diff --git a/kedro-datasets/tests/pandas/test_hdf_dataset.py b/kedro-datasets/tests/pandas/test_hdf_dataset.py index 563ba63d9..67e5468ef 100644 --- a/kedro-datasets/tests/pandas/test_hdf_dataset.py +++ b/kedro-datasets/tests/pandas/test_hdf_dataset.py @@ -215,7 +215,7 @@ def test_save_version_warning( versioned_hdf_data_set.save(dummy_dataframe) def test_http_filesystem_no_versioning(self): - pattern = r"HTTP\(s\) DataSet doesn't support versioning\." + pattern = "Versioning is not supported for HTTP protocols." with pytest.raises(DataSetError, match=pattern): HDFDataSet( diff --git a/kedro-datasets/tests/pandas/test_json_dataset.py b/kedro-datasets/tests/pandas/test_json_dataset.py index df2e856d5..0879309b3 100644 --- a/kedro-datasets/tests/pandas/test_json_dataset.py +++ b/kedro-datasets/tests/pandas/test_json_dataset.py @@ -213,7 +213,7 @@ def test_save_version_warning( versioned_json_data_set.save(dummy_dataframe) def test_http_filesystem_no_versioning(self): - pattern = r"HTTP\(s\) DataSet doesn't support versioning\." + pattern = "Versioning is not supported for HTTP protocols." with pytest.raises(DataSetError, match=pattern): JSONDataSet( diff --git a/kedro-datasets/tests/pandas/test_parquet_dataset.py b/kedro-datasets/tests/pandas/test_parquet_dataset.py index 2d7ce2996..2a7779ec4 100644 --- a/kedro-datasets/tests/pandas/test_parquet_dataset.py +++ b/kedro-datasets/tests/pandas/test_parquet_dataset.py @@ -306,7 +306,7 @@ def test_save_version_warning( versioned_parquet_data_set.save(dummy_dataframe) def test_http_filesystem_no_versioning(self): - pattern = r"HTTP\(s\) DataSet doesn't support versioning\." + pattern = "Versioning is not supported for HTTP protocols." with pytest.raises(DataSetError, match=pattern): ParquetDataSet( diff --git a/kedro-datasets/tests/pandas/test_xml_dataset.py b/kedro-datasets/tests/pandas/test_xml_dataset.py index bd62ea586..81b173db0 100644 --- a/kedro-datasets/tests/pandas/test_xml_dataset.py +++ b/kedro-datasets/tests/pandas/test_xml_dataset.py @@ -213,7 +213,7 @@ def test_save_version_warning( versioned_xml_data_set.save(dummy_dataframe) def test_http_filesystem_no_versioning(self): - pattern = r"HTTP\(s\) DataSet doesn't support versioning\." + pattern = "Versioning is not supported for HTTP protocols." with pytest.raises(DataSetError, match=pattern): XMLDataSet( diff --git a/kedro-datasets/tests/pickle/test_pickle_dataset.py b/kedro-datasets/tests/pickle/test_pickle_dataset.py index fb95681a3..0a22ba6a6 100644 --- a/kedro-datasets/tests/pickle/test_pickle_dataset.py +++ b/kedro-datasets/tests/pickle/test_pickle_dataset.py @@ -236,7 +236,7 @@ def test_save_version_warning( versioned_pickle_data_set.save(dummy_dataframe) def test_http_filesystem_no_versioning(self): - pattern = r"HTTP\(s\) DataSet doesn't support versioning\." + pattern = "Versioning is not supported for HTTP protocols." with pytest.raises(DataSetError, match=pattern): PickleDataSet( diff --git a/kedro-datasets/tests/pillow/test_image_dataset.py b/kedro-datasets/tests/pillow/test_image_dataset.py index ea500b20d..76db3a085 100644 --- a/kedro-datasets/tests/pillow/test_image_dataset.py +++ b/kedro-datasets/tests/pillow/test_image_dataset.py @@ -203,7 +203,7 @@ def test_save_version_warning( versioned_image_dataset.save(image_object) def test_http_filesystem_no_versioning(self): - pattern = r"HTTP\(s\) DataSet doesn't support versioning\." + pattern = "Versioning is not supported for HTTP protocols." with pytest.raises(DataSetError, match=pattern): ImageDataSet( diff --git a/kedro-datasets/tests/polars/test_csv_dataset.py b/kedro-datasets/tests/polars/test_csv_dataset.py index d79183539..59da8d95f 100644 --- a/kedro-datasets/tests/polars/test_csv_dataset.py +++ b/kedro-datasets/tests/polars/test_csv_dataset.py @@ -321,7 +321,7 @@ def test_save_version_warning( versioned_csv_data_set.save(dummy_dataframe) def test_http_filesystem_no_versioning(self): - pattern = r"HTTP\(s\) DataSet doesn't support versioning\." + pattern = "Versioning is not supported for HTTP protocols." with pytest.raises(DataSetError, match=pattern): CSVDataSet( diff --git a/kedro-datasets/tests/spark/test_memory_dataset.py b/kedro-datasets/tests/spark/test_memory_dataset.py index e39bc4653..8dd469217 100644 --- a/kedro-datasets/tests/spark/test_memory_dataset.py +++ b/kedro-datasets/tests/spark/test_memory_dataset.py @@ -1,5 +1,5 @@ import pytest -from kedro.io import MemoryDataSet +from kedro.io import MemoryDataset from pyspark.sql import DataFrame as SparkDataFrame from pyspark.sql import SparkSession from pyspark.sql.functions import col, when @@ -31,7 +31,7 @@ def spark_data_frame(spark_session): @pytest.fixture def memory_dataset(spark_data_frame): - return MemoryDataSet(data=spark_data_frame) + return MemoryDataset(data=spark_data_frame) def test_load_modify_original_data(memory_dataset, spark_data_frame): @@ -44,7 +44,7 @@ def test_load_modify_original_data(memory_dataset, spark_data_frame): def test_save_modify_original_data(spark_data_frame): """Check that the data set object is not updated when the original SparkDataFrame is changed.""" - memory_dataset = MemoryDataSet() + memory_dataset = MemoryDataset() memory_dataset.save(spark_data_frame) spark_data_frame = _update_spark_df(spark_data_frame, 1, 1, "new value") @@ -63,4 +63,4 @@ def test_load_returns_same_spark_object(memory_dataset, spark_data_frame): def test_str_representation(memory_dataset): """Test string representation of the data set""" - assert "MemoryDataSet(data=)" in str(memory_dataset) + assert "MemoryDataset(data=)" in str(memory_dataset) diff --git a/kedro-datasets/tests/tensorflow/test_tensorflow_model_dataset.py b/kedro-datasets/tests/tensorflow/test_tensorflow_model_dataset.py index 774e0e2d9..1e6ef06d7 100644 --- a/kedro-datasets/tests/tensorflow/test_tensorflow_model_dataset.py +++ b/kedro-datasets/tests/tensorflow/test_tensorflow_model_dataset.py @@ -368,7 +368,7 @@ def test_save_version_warning( versioned_tf_model_dataset.save(dummy_tf_base_model) def test_http_filesystem_no_versioning(self, tensorflow_model_dataset): - pattern = r"HTTP\(s\) DataSet doesn't support versioning\." + pattern = "Versioning is not supported for HTTP protocols." with pytest.raises(DataSetError, match=pattern): tensorflow_model_dataset( diff --git a/kedro-datasets/tests/text/test_text_dataset.py b/kedro-datasets/tests/text/test_text_dataset.py index 733cc6c1f..256634786 100644 --- a/kedro-datasets/tests/text/test_text_dataset.py +++ b/kedro-datasets/tests/text/test_text_dataset.py @@ -157,7 +157,7 @@ def test_save_version_warning( versioned_txt_data_set.save(STRING) def test_http_filesystem_no_versioning(self): - pattern = r"HTTP\(s\) DataSet doesn't support versioning\." + pattern = "Versioning is not supported for HTTP protocols." with pytest.raises(DataSetError, match=pattern): TextDataSet( diff --git a/kedro-datasets/tests/tracking/test_json_dataset.py b/kedro-datasets/tests/tracking/test_json_dataset.py index 62172b1a4..9d20a46bc 100644 --- a/kedro-datasets/tests/tracking/test_json_dataset.py +++ b/kedro-datasets/tests/tracking/test_json_dataset.py @@ -177,7 +177,7 @@ def test_save_version_warning( explicit_versioned_json_dataset.save(dummy_data) def test_http_filesystem_no_versioning(self): - pattern = r"HTTP\(s\) DataSet doesn't support versioning\." + pattern = "Versioning is not supported for HTTP protocols." with pytest.raises(DataSetError, match=pattern): JSONDataSet( diff --git a/kedro-datasets/tests/tracking/test_metrics_dataset.py b/kedro-datasets/tests/tracking/test_metrics_dataset.py index 2c1157de9..eed8ecbb6 100644 --- a/kedro-datasets/tests/tracking/test_metrics_dataset.py +++ b/kedro-datasets/tests/tracking/test_metrics_dataset.py @@ -186,7 +186,7 @@ def test_save_version_warning( explicit_versioned_metrics_dataset.save(dummy_data) def test_http_filesystem_no_versioning(self): - pattern = r"HTTP\(s\) DataSet doesn't support versioning\." + pattern = "Versioning is not supported for HTTP protocols." with pytest.raises(DataSetError, match=pattern): MetricsDataSet( diff --git a/kedro-datasets/tests/yaml/test_yaml_dataset.py b/kedro-datasets/tests/yaml/test_yaml_dataset.py index 653606c17..1529ced13 100644 --- a/kedro-datasets/tests/yaml/test_yaml_dataset.py +++ b/kedro-datasets/tests/yaml/test_yaml_dataset.py @@ -182,7 +182,7 @@ def test_save_version_warning( versioned_yaml_data_set.save(dummy_data) def test_http_filesystem_no_versioning(self): - pattern = r"HTTP\(s\) DataSet doesn't support versioning\." + pattern = "Versioning is not supported for HTTP protocols." with pytest.raises(DataSetError, match=pattern): YAMLDataSet(