Skip to content

Commit

Permalink
Fix rebase issues in feature/unification-artifacts (#1932)
Browse files Browse the repository at this point in the history
Fix feature branch gates
  • Loading branch information
sfc-gh-bdufour authored and sfc-gh-astus committed Dec 13, 2024
1 parent caf9f1b commit 1fe4e7c
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 34 deletions.
2 changes: 1 addition & 1 deletion tests/nativeapp/test_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down
18 changes: 16 additions & 2 deletions tests/snowpark/test_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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 = [
Expand Down
4 changes: 2 additions & 2 deletions tests/streamlit/test_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
29 changes: 0 additions & 29 deletions tests/streamlit/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
3 changes: 3 additions & 0 deletions tests/testing_utils/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions tests_integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 1fe4e7c

Please sign in to comment.