From 1fe4e7ce04460cc31bb9e0ac1c9dcf6ec7e254fc Mon Sep 17 00:00:00 2001 From: Bruno Dufour Date: Mon, 9 Dec 2024 04:05:19 -0500 Subject: [PATCH] Fix rebase issues in feature/unification-artifacts (#1932) Fix feature branch gates --- tests/nativeapp/test_artifacts.py | 2 +- tests/snowpark/test_function.py | 18 ++++++++++++++++-- tests/streamlit/test_artifacts.py | 4 ++-- tests/streamlit/test_commands.py | 29 ----------------------------- tests/testing_utils/fixtures.py | 3 +++ tests_integration/conftest.py | 3 +++ 6 files changed, 25 insertions(+), 34 deletions(-) diff --git a/tests/nativeapp/test_artifacts.py b/tests/nativeapp/test_artifacts.py index b098e987ce..6cec78e676 100644 --- a/tests/nativeapp/test_artifacts.py +++ b/tests/nativeapp/test_artifacts.py @@ -19,6 +19,7 @@ import pytest from click import ClickException from snowflake.cli._plugins.nativeapp.artifacts import ( + VersionInfo, build_bundle, find_events_definitions_in_manifest_file, find_version_info_in_manifest_file, @@ -29,7 +30,6 @@ NotInDeployRootError, SourceNotFoundError, TooManyFilesError, - VersionInfo, ) from snowflake.cli.api.project.definition import load_project from snowflake.cli.api.project.schemas.entities.common import PathMapping diff --git a/tests/snowpark/test_function.py b/tests/snowpark/test_function.py index a2887da832..b071277602 100644 --- a/tests/snowpark/test_function.py +++ b/tests/snowpark/test_function.py @@ -249,7 +249,14 @@ def test_deploy_function_no_changes( ) @mock_session_has_warehouse def test_deploy_function_needs_update_because_packages_changes( - mock_download, mock_connector, runner, mock_ctx, mock_cursor, project_directory, project_name, enable_snowpark_glob_support_feature_flag + mock_download, + mock_connector, + runner, + mock_ctx, + mock_cursor, + project_directory, + project_name, + enable_snowpark_glob_support_feature_flag, ): mock_download.return_value = DownloadUnavailablePackagesResult() rows = [ @@ -304,7 +311,14 @@ def test_deploy_function_needs_update_because_packages_changes( ) @mock_session_has_warehouse def test_deploy_function_needs_update_because_handler_changes( - mock_download, mock_connector, runner, mock_ctx, mock_cursor, project_directory, project_name, enable_snowpark_glob_support_feature_flag + mock_download, + mock_connector, + runner, + mock_ctx, + mock_cursor, + project_directory, + project_name, + enable_snowpark_glob_support_feature_flag, ): mock_download.return_value = DownloadUnavailablePackagesResult() rows = [ diff --git a/tests/streamlit/test_artifacts.py b/tests/streamlit/test_artifacts.py index 4b75406d1c..d63f3033df 100644 --- a/tests/streamlit/test_artifacts.py +++ b/tests/streamlit/test_artifacts.py @@ -112,7 +112,7 @@ @mock.patch("snowflake.cli._plugins.snowpark.commands.StageManager.put") @mock.patch( "snowflake.cli._plugins.connection.util.get_ui_parameters", - return_value={UIParameter.NA_ENABLE_REGIONLESS_REDIRECT: "false"}, + return_value={UIParameter.NA_ENABLE_REGIONLESS_REDIRECT: False}, ) def test_deploy_with_artifacts( mock_param, @@ -252,7 +252,7 @@ def test_deploy_with_artifacts( @mock.patch("snowflake.cli._plugins.snowpark.commands.StageManager.put") @mock.patch( "snowflake.cli._plugins.connection.util.get_ui_parameters", - return_value={UIParameter.NA_ENABLE_REGIONLESS_REDIRECT: "false"}, + return_value={UIParameter.NA_ENABLE_REGIONLESS_REDIRECT: False}, ) def test_deploy_with_artifacts_from_other_directory( mock_param, diff --git a/tests/streamlit/test_commands.py b/tests/streamlit/test_commands.py index cd39056335..9a859ad030 100644 --- a/tests/streamlit/test_commands.py +++ b/tests/streamlit/test_commands.py @@ -920,35 +920,6 @@ def test_deploy_streamlit_main_and_pages_files_experimental_replace( ] -@pytest.mark.parametrize( - "project_name,opts", - [ - ("example_streamlit", {"streamlit": {"pages_dir": "foo.bar"}}), - ("example_streamlit", {"streamlit": {"env_file": "foo.bar"}}), - ( - "example_streamlit_v2", - {"entities": {"test_streamlit": {"pages_dir": "foo.bar"}}}, - ), - ( - "example_streamlit_v2", - {"entities": {"test_streamlit": {"artifacts": ["foo.bar"]}}}, - ), - ], -) -@mock.patch("snowflake.connector.connect") -def test_deploy_streamlit_nonexisting_file( - mock_connector, runner, mock_ctx, snapshot, project_directory, opts, project_name -): - ctx = mock_ctx() - mock_connector.return_value = ctx - - with project_directory(project_name, merge_project_definition=opts): - result = runner.invoke(["streamlit", "deploy"]) - - assert result.exit_code == 1 - assert result.output == snapshot - - @mock.patch("snowflake.connector.connect") def test_share_streamlit(mock_connector, runner, mock_ctx): ctx = mock_ctx() diff --git a/tests/testing_utils/fixtures.py b/tests/testing_utils/fixtures.py index 457acec1c6..192776fcc9 100644 --- a/tests/testing_utils/fixtures.py +++ b/tests/testing_utils/fixtures.py @@ -473,5 +473,8 @@ def enable_snowpark_glob_support_feature_flag(): with mock.patch( f"snowflake.cli.api.feature_flags.FeatureFlag.ENABLE_SNOWPARK_GLOB_SUPPORT.is_enabled", return_value=True, + ), mock.patch( + f"snowflake.cli.api.feature_flags.FeatureFlag.ENABLE_SNOWPARK_GLOB_SUPPORT.is_disabled", + return_value=False, ): yield diff --git a/tests_integration/conftest.py b/tests_integration/conftest.py index 6be62f1ce5..1ac9bda801 100644 --- a/tests_integration/conftest.py +++ b/tests_integration/conftest.py @@ -266,5 +266,8 @@ def enable_snowpark_glob_support_feature_flag(): with mock.patch( f"snowflake.cli.api.feature_flags.FeatureFlag.ENABLE_SNOWPARK_GLOB_SUPPORT.is_enabled", return_value=True, + ), mock.patch( + f"snowflake.cli.api.feature_flags.FeatureFlag.ENABLE_SNOWPARK_GLOB_SUPPORT.is_disabled", + return_value=False, ): yield