Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed precommit errors and tests
Browse files Browse the repository at this point in the history
sfc-gh-astus committed Dec 5, 2024
1 parent 26b98ce commit 550da8c
Showing 7 changed files with 16 additions and 33 deletions.
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -25,6 +25,10 @@ repos:
hooks:
- id: mypy
additional_dependencies: [types-pkg-resources==0.1.3, types-all==1.0.0]
exclude: >
(?x)
^tests/test_data/projects/.*|
^tests_integration/test_data/projects/.*
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
2 changes: 1 addition & 1 deletion tests/nativeapp/test_artifacts.py
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion tests/snowpark/test_function.py
Original file line number Diff line number Diff line change
@@ -18,12 +18,12 @@
from unittest import mock

import pytest

from snowflake.cli._plugins.snowpark.package_utils import (
DownloadUnavailablePackagesResult,
)
from snowflake.cli.api.errno import DOES_NOT_EXIST_OR_NOT_AUTHORIZED
from snowflake.connector import ProgrammingError

from tests_common import IS_WINDOWS

if IS_WINDOWS:
4 changes: 2 additions & 2 deletions tests/streamlit/test_artifacts.py
Original file line number Diff line number Diff line change
@@ -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,
29 changes: 0 additions & 29 deletions tests/streamlit/test_commands.py
Original file line number Diff line number Diff line change
@@ -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()
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from common.hello import say_hello

import streamlit as st

st.title(f"Example streamlit app. {say_hello()}")
3 changes: 3 additions & 0 deletions tests_integration/conftest.py
Original file line number Diff line number Diff line change
@@ -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 550da8c

Please sign in to comment.