Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
Signed-off-by: Sid Murching <[email protected]>
  • Loading branch information
smurching committed Sep 26, 2024
1 parent 998d8a3 commit 34804a2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion agent_app_sample_code/00_global_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
# UC Catalog & Schema where outputs tables/indexes are saved
# By default, will use the current user name to create a unique UC catalog/schema & vector search endpoint
# If this catalog/schema does not exist, you need create catalog/schema permissions.
UC_CATALOG = f"smurching"
UC_CATALOG = f"{user_name}_catalog"
UC_SCHEMA = f"cookbook"

## UC Model name where the Agent's model is logged
Expand Down
5 changes: 5 additions & 0 deletions agent_app_sample_code/tests/test_file_loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,8 @@ def test_load_files_to_df(spark, tmpdir):
"content": "file2 content",
}])
pd.testing.assert_frame_equal(raw_pandas_df, expected_df)

def test_load_files_to_df_throws_if_no_files(spark, tmpdir):
temp_dir = tmpdir.mkdir("files_subdir")
with pytest.raises(Exception, match="does not contain any files"):
load_files_to_df(spark, str(temp_dir))
2 changes: 1 addition & 1 deletion agent_app_sample_code/utils/file_loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def load_files_to_df(

# Load the raw riles
raw_files_df = (
https://spark.apache.org/docs/latest/sql-data-sources-binaryFile.html.option("recursiveFileLookup", "true")
spark.read.format("binaryFile").option("recursiveFileLookup", "true")
.load(source_path)
)

Expand Down

0 comments on commit 34804a2

Please sign in to comment.