|
1 | | -from unittest.mock import Mock, MagicMock, patch, ANY |
2 | | -import pytest |
| 1 | +import re |
| 2 | +from unittest.mock import ANY, MagicMock, patch |
3 | 3 |
|
4 | | -from feast.infra.online_stores.sqlite import SqliteOnlineStoreConfig |
| 4 | +import pytest |
5 | 5 |
|
6 | 6 | from feast.infra.offline_stores.snowflake import ( |
7 | 7 | SnowflakeOfflineStoreConfig, |
8 | 8 | SnowflakeRetrievalJob, |
9 | 9 | ) |
10 | | - |
| 10 | +from feast.infra.online_stores.sqlite import SqliteOnlineStoreConfig |
11 | 11 | from feast.repo_config import RepoConfig |
12 | 12 |
|
13 | | -import re |
14 | 13 |
|
15 | | -@pytest.fixture(params=['s3','s3gov']) |
| 14 | +@pytest.fixture(params=["s3", "s3gov"]) |
16 | 15 | def retrieval_job(request): |
17 | 16 | offline_store_config = SnowflakeOfflineStoreConfig( |
18 | 17 | type="snowflake.offline", |
@@ -44,10 +43,15 @@ def retrieval_job(request): |
44 | 43 |
|
45 | 44 | def test_to_remote_storage(retrieval_job): |
46 | 45 | stored_files = ["just a path", "maybe another"] |
47 | | - with patch.object(retrieval_job, "to_snowflake", return_value=None) as mock_to_snowflake, \ |
48 | | - patch.object(retrieval_job, "_get_file_names_from_copy_into", return_value=stored_files) as mock_get_file_names_from_copy: |
49 | | - assert retrieval_job.to_remote_storage() == stored_files, "should return the list of files" |
| 46 | + with patch.object( |
| 47 | + retrieval_job, "to_snowflake", return_value=None |
| 48 | + ) as mock_to_snowflake, patch.object( |
| 49 | + retrieval_job, "_get_file_names_from_copy_into", return_value=stored_files |
| 50 | + ) as mock_get_file_names_from_copy: |
| 51 | + assert ( |
| 52 | + retrieval_job.to_remote_storage() == stored_files |
| 53 | + ), "should return the list of files" |
50 | 54 | mock_to_snowflake.assert_called_once() |
51 | 55 | mock_get_file_names_from_copy.assert_called_once_with(ANY, ANY) |
52 | 56 | native_path = mock_get_file_names_from_copy.call_args[0][1] |
53 | | - assert re.match(f"^s3://.*", native_path), "path should be s3://*" |
| 57 | + assert re.match("^s3://.*", native_path), "path should be s3://*" |
0 commit comments