Skip to content

Commit

Permalink
test(datasets): update the "no versioning" message (#245)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
deepyaman committed Jun 21, 2023
1 parent 031b737 commit e491c5c
Show file tree
Hide file tree
Showing 24 changed files with 27 additions and 26 deletions.
1 change: 1 addition & 0 deletions .github/workflows/validate-pr-title.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ jobs:
datasets
docker
telemetry
wip: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/tests/email/test_message_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/tests/geojson/test_geojson_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/tests/holoviews/test_holoviews_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/tests/json/test_json_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/tests/libsvm/test_svmlight_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/tests/matplotlib/test_matplotlib_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/tests/pandas/test_csv_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/tests/pandas/test_excel_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/tests/pandas/test_feather_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/tests/pandas/test_hdf_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/tests/pandas/test_json_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/tests/pandas/test_parquet_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/tests/pandas/test_xml_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/tests/pickle/test_pickle_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/tests/pillow/test_image_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/tests/polars/test_csv_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
8 changes: 4 additions & 4 deletions kedro-datasets/tests/spark/test_memory_dataset.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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):
Expand All @@ -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")

Expand All @@ -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=<DataFrame>)" in str(memory_dataset)
assert "MemoryDataset(data=<DataFrame>)" in str(memory_dataset)
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/tests/text/test_text_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/tests/tracking/test_json_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/tests/tracking/test_metrics_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion kedro-datasets/tests/yaml/test_yaml_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit e491c5c

Please sign in to comment.