diff --git a/tests/unit/source_code/linters/test_pyspark.py b/tests/unit/source_code/linters/test_pyspark.py index 5863b49a87..970af7969b 100644 --- a/tests/unit/source_code/linters/test_pyspark.py +++ b/tests/unit/source_code/linters/test_pyspark.py @@ -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): @@ -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: @@ -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 +