From 8fe5fa4810bb639013222d4bf1da3d9d337fb6d3 Mon Sep 17 00:00:00 2001 From: Jitendra Gundaniya <38945204+jitu5@users.noreply.github.com> Date: Fri, 31 May 2024 13:59:48 +0100 Subject: [PATCH] Enable/disable preview for all the datasets when publishing Kedro-Viz from CLI (#1894) * Add options for cli common with disable preview of datasets Signed-off-by: Jitendra Gundaniya * New approach for disable preview Signed-off-by: <> * Disable preview for cli and lint fix Signed-off-by: Jitendra Gundaniya * deploy api with preview Signed-off-by: Jitendra Gundaniya * Removing UI changes Signed-off-by: Jitendra Gundaniya * Removing UI changes Signed-off-by: Jitendra Gundaniya * refactor disable preview cli Signed-off-by: ravi-kumar-pilla * fix lint Signed-off-by: ravi-kumar-pilla * fix lint Signed-off-by: ravi-kumar-pilla * testing 1 Signed-off-by: ravi-kumar-pilla * change help text Signed-off-by: ravi-kumar-pilla * change help text Signed-off-by: ravi-kumar-pilla * update tests Signed-off-by: ravi-kumar-pilla * format help text Signed-off-by: ravi-kumar-pilla * change default preview for run Signed-off-by: ravi-kumar-pilla * update release note Signed-off-by: ravi-kumar-pilla * address vale suggestion Signed-off-by: ravi-kumar-pilla * fix pytests and linter Signed-off-by: ravi-kumar-pilla * adjust file permission Signed-off-by: ravi-kumar-pilla * update release note Signed-off-by: ravi-kumar-pilla * --include-preview flag added for CLI Signed-off-by: Jitendra Gundaniya * are_datasets_previewable renamed to is_all_previews_enabled Signed-off-by: Jitendra Gundaniya * lint fix Signed-off-by: Jitendra Gundaniya * type ignore add for TRANSCODING_SEPARATOR Signed-off-by: Jitendra Gundaniya --------- Signed-off-by: Jitendra Gundaniya Signed-off-by: <> Signed-off-by: ravi-kumar-pilla Co-authored-by: ravi-kumar-pilla --- RELEASE.md | 2 + package/kedro_viz/api/rest/responses.py | 11 +++- .../integrations/deployment/base_deployer.py | 8 +-- package/kedro_viz/launchers/cli.py | 34 +++++++++-- package/kedro_viz/models/flowchart.py | 25 +++++++-- package/kedro_viz/server.py | 5 +- package/tests/conftest.py | 7 ++- .../test_api/test_rest/test_responses.py | 22 +++++--- .../test_integrations/test_azure_deployer.py | 2 +- .../test_integrations/test_base_deployer.py | 6 +- .../test_deployer_factory.py | 3 +- .../test_integrations/test_gcp_deployer.py | 2 +- package/tests/test_launchers/test_cli.py | 56 ++++++++++++++++--- package/tests/test_models/test_flowchart.py | 13 ++++- package/tests/test_server.py | 2 +- 15 files changed, 153 insertions(+), 45 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 842b09c916..8da48896b5 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -13,6 +13,8 @@ Please follow the established format: - Introduce the toggle to expand and collapse all pipelines button in the utility bar. (#1858) - Allow Kedro-Viz commands to run from any sub directory within Kedro project. (#1871) +- Enable/disable preview for all the datasets when publishing Kedro-Viz from CLI. (#1894) + ## Bug fixes and other changes - Fix broken URL when active pipeline name changes on initial load. (#1914) - Fix bug related to tag filtering and sharing with stateful URL. (#1878) diff --git a/package/kedro_viz/api/rest/responses.py b/package/kedro_viz/api/rest/responses.py index 7850d091ad..8da71d0354 100644 --- a/package/kedro_viz/api/rest/responses.py +++ b/package/kedro_viz/api/rest/responses.py @@ -420,8 +420,13 @@ def save_api_main_response_to_fs(main_path: str, remote_fs: Any): raise exc -def save_api_node_response_to_fs(nodes_path: str, remote_fs: Any): +def save_api_node_response_to_fs( + nodes_path: str, remote_fs: Any, is_all_previews_enabled: bool +): """Saves API /nodes/{node} response to a directory.""" + # Set if preview is enabled/disabled for all data nodes + DataNodeMetadata.set_is_all_previews_enabled(is_all_previews_enabled) + for nodeId in data_access_manager.nodes.get_node_ids(): try: write_api_response_to_fs( @@ -452,7 +457,7 @@ def save_api_pipeline_response_to_fs(pipelines_path: str, remote_fs: Any): raise exc -def save_api_responses_to_fs(path: str, remote_fs: Any): +def save_api_responses_to_fs(path: str, remote_fs: Any, is_all_previews_enabled: bool): """Saves all Kedro Viz API responses to a directory.""" try: logger.debug( @@ -470,7 +475,7 @@ def save_api_responses_to_fs(path: str, remote_fs: Any): remote_fs.makedirs(pipelines_path, exist_ok=True) save_api_main_response_to_fs(main_path, remote_fs) - save_api_node_response_to_fs(nodes_path, remote_fs) + save_api_node_response_to_fs(nodes_path, remote_fs, is_all_previews_enabled) save_api_pipeline_response_to_fs(pipelines_path, remote_fs) except Exception as exc: # pragma: no cover diff --git a/package/kedro_viz/integrations/deployment/base_deployer.py b/package/kedro_viz/integrations/deployment/base_deployer.py index 22c4fcc819..35b7fc1818 100644 --- a/package/kedro_viz/integrations/deployment/base_deployer.py +++ b/package/kedro_viz/integrations/deployment/base_deployer.py @@ -33,9 +33,9 @@ def __init__(self): self._path = None self._fs = None - def _upload_api_responses(self): + def _upload_api_responses(self, is_all_previews_enabled: bool): """Write API responses to the build.""" - save_api_responses_to_fs(self._path, self._fs) + save_api_responses_to_fs(self._path, self._fs, is_all_previews_enabled) def _ingest_heap_analytics(self): """Ingest heap analytics to index file in the build.""" @@ -98,9 +98,9 @@ def _upload_deploy_viz_metadata_file(self): logger.exception("Upload failed: %s ", exc) raise exc - def deploy(self): + def deploy(self, is_all_previews_enabled: bool = False): """Create and deploy all static files to local/remote file system""" - self._upload_api_responses() + self._upload_api_responses(is_all_previews_enabled) self._upload_static_files(_HTML_DIR) self._upload_deploy_viz_metadata_file() diff --git a/package/kedro_viz/launchers/cli.py b/package/kedro_viz/launchers/cli.py index 5c2bcac75f..b3bf7654bc 100644 --- a/package/kedro_viz/launchers/cli.py +++ b/package/kedro_viz/launchers/cli.py @@ -234,7 +234,12 @@ def run( is_flag=True, help="A flag to include all registered hooks in your Kedro Project", ) -def deploy(platform, endpoint, bucket_name, include_hooks): +@click.option( + "--include-preview", + is_flag=True, + help="Enable/disable preview for all the datasets.", +) +def deploy(platform, endpoint, bucket_name, include_hooks, include_preview): """Deploy and host Kedro Viz on provided platform""" if not platform or platform.lower() not in SHAREABLEVIZ_SUPPORTED_PLATFORMS: display_cli_message( @@ -252,7 +257,13 @@ def deploy(platform, endpoint, bucket_name, include_hooks): ) return - create_shareableviz_process(platform, endpoint, bucket_name, include_hooks) + create_shareableviz_process( + platform, + include_preview, + endpoint, + bucket_name, + include_hooks, + ) @viz.command(context_settings={"help_option_names": ["-h", "--help"]}) @@ -261,14 +272,23 @@ def deploy(platform, endpoint, bucket_name, include_hooks): is_flag=True, help="A flag to include all registered hooks in your Kedro Project", ) -def build(include_hooks): +@click.option( + "--include-preview", + is_flag=True, + help="Enable/disable preview for all the datasets.", +) +def build(include_hooks, include_preview): """Create build directory of local Kedro Viz instance with Kedro project data""" - create_shareableviz_process("local", include_hooks=include_hooks) + create_shareableviz_process("local", include_preview, include_hooks=include_hooks) def create_shareableviz_process( - platform, endpoint=None, bucket_name=None, include_hooks=False + platform, + is_all_previews_enabled, + endpoint=None, + bucket_name=None, + include_hooks=False, ): """Creates platform specific deployer process""" try: @@ -279,6 +299,7 @@ def create_shareableviz_process( target=load_and_deploy_viz, args=( platform, + is_all_previews_enabled, endpoint, bucket_name, include_hooks, @@ -354,6 +375,7 @@ def create_shareableviz_process( def load_and_deploy_viz( platform, + is_all_previews_enabled, endpoint, bucket_name, include_hooks, @@ -369,7 +391,7 @@ def load_and_deploy_viz( # Start the deployment deployer = DeployerFactory.create_deployer(platform, endpoint, bucket_name) - deployer.deploy() + deployer.deploy(is_all_previews_enabled) except ( # pylint: disable=catching-non-exception diff --git a/package/kedro_viz/models/flowchart.py b/package/kedro_viz/models/flowchart.py index cd68430624..e4dec1f6ce 100644 --- a/package/kedro_viz/models/flowchart.py +++ b/package/kedro_viz/models/flowchart.py @@ -8,7 +8,7 @@ from enum import Enum from pathlib import Path from types import FunctionType -from typing import Any, Dict, List, Optional, Set, Union, cast +from typing import Any, ClassVar, Dict, List, Optional, Set, Union, cast from kedro.pipeline.node import Node as KedroNode from pydantic import ( @@ -722,12 +722,19 @@ class DataNodeMetadata(GraphNodeMetadata): Args: data_node (DataNode): Data node to which this metadata belongs to. + Attributes: + is_all_previews_enabled (bool): Class-level attribute to determine if + previews are enabled for all nodes. This can be configured via CLI + or UI to manage the preview settings. + Raises: AssertionError: If data_node is not supplied during instantiation """ data_node: DataNode = Field(..., exclude=True) + is_all_previews_enabled: ClassVar[bool] = True + type: Optional[str] = Field( default=None, validate_default=True, description="The type of the data node" ) @@ -769,6 +776,10 @@ def check_data_node_exists(cls, values): cls.set_data_node_and_dataset(values["data_node"]) return values + @classmethod + def set_is_all_previews_enabled(cls, value: bool): + cls.is_all_previews_enabled = value + @classmethod def set_data_node_and_dataset(cls, data_node): cls.data_node = data_node @@ -799,8 +810,10 @@ def set_run_command(cls, _): @field_validator("preview") @classmethod def set_preview(cls, _): - if not cls.data_node.is_preview_enabled() or not hasattr( - cls.dataset, "preview" + if ( + not cls.data_node.is_preview_enabled() + or not hasattr(cls.dataset, "preview") + or not cls.is_all_previews_enabled ): return None @@ -824,8 +837,10 @@ def set_preview(cls, _): @field_validator("preview_type") @classmethod def set_preview_type(cls, _): - if not cls.data_node.is_preview_enabled() or not hasattr( - cls.dataset, "preview" + if ( + not cls.data_node.is_preview_enabled() + or not hasattr(cls.dataset, "preview") + or not cls.is_all_previews_enabled ): return None diff --git a/package/kedro_viz/server.py b/package/kedro_viz/server.py index eb31f7a9c9..384a3545dc 100644 --- a/package/kedro_viz/server.py +++ b/package/kedro_viz/server.py @@ -125,9 +125,10 @@ def run_server( pipeline_name, extra_params, ) - + # [TODO: As we can do this with `kedro viz build`, + # we need to shift this feature outside of kedro viz run] if save_file: - save_api_responses_to_fs(save_file, fsspec.filesystem("file")) + save_api_responses_to_fs(save_file, fsspec.filesystem("file"), True) app = apps.create_api_app_from_project(path, autoreload) else: diff --git a/package/tests/conftest.py b/package/tests/conftest.py index cc77364d74..2c6426105a 100644 --- a/package/tests/conftest.py +++ b/package/tests/conftest.py @@ -17,7 +17,7 @@ from kedro_viz.data_access import DataAccessManager from kedro_viz.integrations.kedro.hooks import DatasetStatsHook from kedro_viz.integrations.kedro.sqlite_store import SQLiteStore -from kedro_viz.models.flowchart import GraphNode +from kedro_viz.models.flowchart import DataNodeMetadata, GraphNode from kedro_viz.server import populate_data @@ -350,3 +350,8 @@ def pipeline_with_data_sets_mock(): pipeline = mock.MagicMock() pipeline.data_sets.return_value = ["model_inputs#csv"] return pipeline + + +@pytest.fixture(autouse=True) +def reset_is_all_previews_enabled(): + DataNodeMetadata.is_all_previews_enabled = True diff --git a/package/tests/test_api/test_rest/test_responses.py b/package/tests/test_api/test_rest/test_responses.py index 79c05092e4..da46a7a5f3 100644 --- a/package/tests/test_api/test_rest/test_responses.py +++ b/package/tests/test_api/test_rest/test_responses.py @@ -979,7 +979,7 @@ def test_save_api_node_response_to_fs(self, mocker): ) remote_fs = Mock() - save_api_node_response_to_fs(nodes_path, remote_fs) + save_api_node_response_to_fs(nodes_path, remote_fs, False) assert mock_write_api_response_to_fs.call_count == len(nodeIds) assert mock_get_node_metadata_response.call_count == len(nodeIds) @@ -1031,14 +1031,16 @@ def test_save_api_pipeline_response_to_fs(self, mocker): mock_write_api_response_to_fs.assert_has_calls(expected_calls, any_order=True) @pytest.mark.parametrize( - "file_path, protocol", + "file_path, protocol, is_all_previews_enabled", [ - ("s3://shareableviz", "s3"), - ("abfs://shareableviz", "abfs"), - ("shareableviz", "file"), + ("s3://shareableviz", "s3", True), + ("abfs://shareableviz", "abfs", False), + ("shareableviz", "file", True), ], ) - def test_save_api_responses_to_fs(self, file_path, protocol, mocker): + def test_save_api_responses_to_fs( + self, file_path, protocol, is_all_previews_enabled, mocker + ): mock_api_main_response_to_fs = mocker.patch( "kedro_viz.api.rest.responses.save_api_main_response_to_fs" ) @@ -1052,13 +1054,17 @@ def test_save_api_responses_to_fs(self, file_path, protocol, mocker): mock_filesystem = mocker.patch("fsspec.filesystem") mock_filesystem.return_value.protocol = protocol - save_api_responses_to_fs(file_path, mock_filesystem.return_value) + save_api_responses_to_fs( + file_path, mock_filesystem.return_value, is_all_previews_enabled + ) mock_api_main_response_to_fs.assert_called_once_with( f"{file_path}/api/main", mock_filesystem.return_value ) mock_api_node_response_to_fs.assert_called_once_with( - f"{file_path}/api/nodes", mock_filesystem.return_value + f"{file_path}/api/nodes", + mock_filesystem.return_value, + is_all_previews_enabled, ) mock_api_pipeline_response_to_fs.assert_called_once_with( f"{file_path}/api/pipelines", mock_filesystem.return_value diff --git a/package/tests/test_integrations/test_azure_deployer.py b/package/tests/test_integrations/test_azure_deployer.py index 4c524811b4..4b1a8d7a30 100644 --- a/package/tests/test_integrations/test_azure_deployer.py +++ b/package/tests/test_integrations/test_azure_deployer.py @@ -26,7 +26,7 @@ def mock_file_system(mocker): class TestAzureDeployer: - def test_deploy(self, endpoint, bucket_name, mocker): + def test_deploy(self, endpoint, bucket_name, mocker, mock_file_system): deployer = AzureDeployer(endpoint, bucket_name) mocker.patch.object(deployer, "_upload_api_responses") diff --git a/package/tests/test_integrations/test_base_deployer.py b/package/tests/test_integrations/test_base_deployer.py index d05947408e..a933e6229a 100644 --- a/package/tests/test_integrations/test_base_deployer.py +++ b/package/tests/test_integrations/test_base_deployer.py @@ -14,9 +14,11 @@ def test_upload_api_responses(self, mocker): "kedro_viz.integrations.deployment.base_deployer.save_api_responses_to_fs" ) build = ConcreteBaseDeployer() - build._upload_api_responses() + build._upload_api_responses(False) - save_api_responses_to_fs_mock.assert_called_once_with(build._path, build._fs) + save_api_responses_to_fs_mock.assert_called_once_with( + build._path, build._fs, False + ) def test_upload_static_files(self, mocker): mocker.patch("fsspec.filesystem") diff --git a/package/tests/test_integrations/test_deployer_factory.py b/package/tests/test_integrations/test_deployer_factory.py index c14794b087..638fe94065 100644 --- a/package/tests/test_integrations/test_deployer_factory.py +++ b/package/tests/test_integrations/test_deployer_factory.py @@ -18,7 +18,8 @@ ("gcp", "http://mocked-url.com", "shareableviz", GCPDeployer), ], ) -def test_create_deployer(platform, endpoint, bucket_name, deployer_class): +def test_create_deployer(platform, endpoint, bucket_name, deployer_class, mocker): + mocker.patch("fsspec.filesystem") deployer = DeployerFactory.create_deployer(platform, endpoint, bucket_name) assert isinstance(deployer, deployer_class) assert deployer._endpoint == endpoint diff --git a/package/tests/test_integrations/test_gcp_deployer.py b/package/tests/test_integrations/test_gcp_deployer.py index 56daac7747..86f4f2094e 100755 --- a/package/tests/test_integrations/test_gcp_deployer.py +++ b/package/tests/test_integrations/test_gcp_deployer.py @@ -21,7 +21,7 @@ def mock_file_system(mocker): class TestGCPDeployer: - def test_deploy(self, endpoint, bucket_name, mocker): + def test_deploy(self, endpoint, bucket_name, mocker, mock_file_system): deployer = GCPDeployer(endpoint, bucket_name) mocker.patch.object(deployer, "_upload_api_responses") diff --git a/package/tests/test_launchers/test_cli.py b/package/tests/test_launchers/test_cli.py index 4ad1b6dd86..94c75c95a3 100755 --- a/package/tests/test_launchers/test_cli.py +++ b/package/tests/test_launchers/test_cli.py @@ -445,6 +445,25 @@ def test_viz_command_group(mocker, mock_click_echo): "include_hooks": True, }, ), + ( + [ + "viz", + "deploy", + "--platform", + "aws", + "--endpoint", + "http://example-bucket.s3-website.us-east-2.amazonaws.com/", + "--bucket-name", + "example-bucket", + "--include-preview", + ], + { + "platform": "aws", + "endpoint": "http://example-bucket.s3-website.us-east-2.amazonaws.com/", + "bucket_name": "example-bucket", + "preview": True, + }, + ), ], ) def test_viz_deploy_valid_endpoint_and_bucket(command_options, deployer_args, mocker): @@ -461,6 +480,7 @@ def test_viz_deploy_valid_endpoint_and_bucket(command_options, deployer_args, mo create_shareableviz_process_mock.assert_called_once_with( deployer_args.get("platform"), + deployer_args.get("preview", False), deployer_args.get("endpoint"), deployer_args.get("bucket_name"), deployer_args.get("include_hooks", False), @@ -539,6 +559,10 @@ def test_viz_deploy_invalid_endpoint(mocker, mock_click_echo): ["viz", "build", "--include-hooks"], {"platform": "local", "include_hooks": True}, ), + ( + ["viz", "build", "--include-preview"], + {"platform": "local", "preview": True}, + ), ], ) def test_successful_build_with_existing_static_files( @@ -557,15 +581,18 @@ def test_successful_build_with_existing_static_files( create_shareableviz_process_mock.assert_called_once_with( build_args.get("platform"), + build_args.get("preview", False), include_hooks=build_args.get("include_hooks", False), ) @pytest.mark.parametrize( - "platform, endpoint, bucket_name, include_hooks, process_completed_value", + "platform, is_all_previews_enabled, endpoint, bucket_name," + "include_hooks, process_completed_value", [ ( "azure", + True, "https://example-bucket.web.core.windows.net", "example-bucket", True, @@ -573,6 +600,7 @@ def test_successful_build_with_existing_static_files( ), ( "aws", + True, "http://example-bucket.s3-website.us-east-2.amazonaws.com/", "example-bucket", True, @@ -580,14 +608,16 @@ def test_successful_build_with_existing_static_files( ), ( "gcp", + False, "http://34.120.87.227/", "example-bucket", False, 1, ), - ("local", None, None, False, 1), + ("local", False, None, None, False, 1), ( "azure", + True, "https://example-bucket.web.core.windows.net", "example-bucket", False, @@ -595,6 +625,7 @@ def test_successful_build_with_existing_static_files( ), ( "aws", + False, "http://example-bucket.s3-website.us-east-2.amazonaws.com/", "example-bucket", False, @@ -602,16 +633,18 @@ def test_successful_build_with_existing_static_files( ), ( "gcp", + True, "http://34.120.87.227/", "example-bucket", True, 0, ), - ("local", None, None, True, 0), + ("local", True, None, None, True, 0), ], ) def test_create_shareableviz_process( platform, + is_all_previews_enabled, endpoint, bucket_name, include_hooks, @@ -624,13 +657,16 @@ def test_create_shareableviz_process( mock_click_echo, ): mock_process_completed.return_value.value = process_completed_value - cli.create_shareableviz_process(platform, endpoint, bucket_name, include_hooks) + cli.create_shareableviz_process( + platform, is_all_previews_enabled, endpoint, bucket_name, include_hooks + ) # Assert the mocks were called as expected mock_viz_deploy_process.assert_called_once_with( target=mock_viz_load_and_deploy, args=( platform, + is_all_previews_enabled, endpoint, bucket_name, include_hooks, @@ -670,10 +706,11 @@ def test_create_shareableviz_process( @pytest.mark.parametrize( - "platform, endpoint, bucket_name, include_hooks, package_name", + "platform, is_all_previews_enabled, endpoint, bucket_name, include_hooks, package_name", [ ( "azure", + False, "https://example-bucket.web.core.windows.net", "example-bucket", False, @@ -681,17 +718,19 @@ def test_create_shareableviz_process( ), ( "aws", + True, "http://example-bucket.s3-website.us-east-2.amazonaws.com/", "example-bucket", True, "demo_project", ), - ("gcp", "http://34.120.87.227/", "example-bucket", False, "demo_project"), - ("local", None, None, True, "demo_project"), + ("gcp", True, "http://34.120.87.227/", "example-bucket", False, "demo_project"), + ("local", False, None, None, True, "demo_project"), ], ) def test_load_and_deploy_viz_success( platform, + is_all_previews_enabled, endpoint, bucket_name, include_hooks, @@ -707,6 +746,7 @@ def test_load_and_deploy_viz_success( cli.load_and_deploy_viz( platform, + is_all_previews_enabled, endpoint, bucket_name, include_hooks, @@ -721,5 +761,5 @@ def test_load_and_deploy_viz_success( mock_DeployerFactory.create_deployer.assert_called_once_with( platform, endpoint, bucket_name ) - deployer_mock.deploy.assert_called_once() + deployer_mock.deploy.assert_called_once_with(is_all_previews_enabled) mock_click_echo.echo.assert_not_called() diff --git a/package/tests/test_models/test_flowchart.py b/package/tests/test_models/test_flowchart.py index 43697fd289..b337552a57 100644 --- a/package/tests/test_models/test_flowchart.py +++ b/package/tests/test_models/test_flowchart.py @@ -394,6 +394,13 @@ def test_is_preview_enabled(self): ) assert data_node.is_preview_enabled() is False + def test_is_all_previews_enabled(self, example_data_node): + DataNodeMetadata.set_is_all_previews_enabled(False) + preview_node_metadata = DataNodeMetadata(data_node=example_data_node) + + assert preview_node_metadata.preview is None + assert preview_node_metadata.preview_type is None + def test_preview_data_node_metadata(self, example_data_node): expected_preview_data = { "columns": ["id", "company_rating", "company_location"], @@ -404,9 +411,11 @@ def test_preview_data_node_metadata(self, example_data_node): [12345, "80%", "Barbados"], ], } + preview_node_metadata = DataNodeMetadata(data_node=example_data_node) assert preview_node_metadata.preview == expected_preview_data + assert preview_node_metadata.preview_type == "TablePreview" def test_preview_data_node_metadata_exception(self, caplog): empty_dataset = CSVDataset(filepath="temp.csv") @@ -444,10 +453,10 @@ def test_preview_default_data_node_metadata( assert preview_node_metadata.preview == expected_preview_data def test_preview_data_node_metadata_not_exist(self, example_data_node, mocker): - mocker.patch("kedro_datasets.pandas.CSVDataset.preview", return_value=False) + mocker.patch("kedro_datasets.pandas.CSVDataset.preview", return_value=None) preview_node_metadata = DataNodeMetadata(data_node=example_data_node) - assert preview_node_metadata.preview is False + assert preview_node_metadata.preview is None def test_transcoded_data_node_metadata(self): dataset = CSVDataset(filepath="/tmp/dataset.csv") diff --git a/package/tests/test_server.py b/package/tests/test_server.py index 391f9511c7..33fe6f2e1b 100644 --- a/package/tests/test_server.py +++ b/package/tests/test_server.py @@ -156,5 +156,5 @@ def test_save_file(self, tmp_path, mocker): save_file = tmp_path / "save.json" run_server(save_file=save_file) save_api_responses_to_fs_mock.assert_called_once_with( - save_file, mock_filesystem.return_value + save_file, mock_filesystem.return_value, True )