Skip to content

Add failed linter test #3716

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion tests/unit/source_code/linters/test_pyspark.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def test_spark_dynamic_sql(empty_index) -> None:
sqf = SparkTableNamePyLinter(ftf, empty_index, session_state)
assert not list(sqf.lint(source))


def test_linter_context_python_linter_lints_table_pending_migration_with_empty_index(empty_index) -> None:
source_code = """
for i in range(10):
Expand Down Expand Up @@ -526,6 +525,23 @@ def test_from_table_sql_py_linter_fixes_migrated_table(migration_index) -> None:
)
],
),
# Test for mount calls inside a function
(
"""
def searchPath(rep, dateAlternative = None):
return dbutils.fs.ls(rep)
variable = searchPath('/mnt/something/', some_variable)""",
[
Deprecation(
code='direct-filesystem-access',
message="The use of direct filesystem references is deprecated: /mnt/something/",
start_line=0,
start_col=0,
end_line=0,
end_col=41,
)
],
),
],
)
def test_spark_cloud_direct_access(empty_index, code, expected) -> None:
Expand Down Expand Up @@ -656,3 +672,4 @@ def test_spark_collect_tables_ignores_dfsas(source_code, expected, migration_ind
for used_table in used_tables:
actual = (used_table.catalog_name, used_table.schema_name, used_table.table_name)
assert actual in expected