Skip to content

Commit

Permalink
Fixed precommit errors and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-astus committed Dec 5, 2024
1 parent 26b98ce commit f232e4f
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 32 deletions.
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
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
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
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
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 f232e4f

Please sign in to comment.