Skip to content

Commit 82f05c0

Browse files
committed
update pytest to use bacj engine
1 parent 070013e commit 82f05c0

File tree

4 files changed

+16
-17
lines changed

4 files changed

+16
-17
lines changed

graphrag/storage/blob_pipeline_storage.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ def __init__(
6565
self._container_name,
6666
self._path_prefix,
6767
)
68-
self.create_container()
68+
self._create_container()
6969

70-
def create_container(self) -> None:
70+
def _create_container(self) -> None:
7171
"""Create the container if it does not exist."""
72-
if not self.container_exists():
72+
if not self._container_exists():
7373
container_name = self._container_name
7474
container_names = [
7575
container.name
@@ -78,12 +78,12 @@ def create_container(self) -> None:
7878
if container_name not in container_names:
7979
self._blob_service_client.create_container(container_name)
8080

81-
def delete_container(self) -> None:
81+
def _delete_container(self) -> None:
8282
"""Delete the container."""
83-
if self.container_exists():
83+
if self._container_exists():
8484
self._blob_service_client.delete_container(self._container_name)
8585

86-
def container_exists(self) -> bool:
86+
def _container_exists(self) -> bool:
8787
"""Check if the container exists."""
8888
container_name = self._container_name
8989
container_names = [
@@ -119,7 +119,7 @@ def find(
119119
file_pattern.pattern,
120120
)
121121

122-
def blobname(blob_name: str) -> str:
122+
def _blobname(blob_name: str) -> str:
123123
if blob_name.startswith(self._path_prefix):
124124
blob_name = blob_name.replace(self._path_prefix, "", 1)
125125
if blob_name.startswith("/"):
@@ -146,7 +146,7 @@ def item_filter(item: dict[str, Any]) -> bool:
146146
if match and blob.name.startswith(base_dir):
147147
group = match.groupdict()
148148
if item_filter(group):
149-
yield (blobname(blob.name), group)
149+
yield (_blobname(blob.name), group)
150150
num_loaded += 1
151151
if max_count > 0 and num_loaded >= max_count:
152152
break
@@ -203,7 +203,7 @@ async def set(self, key: str, value: Any, encoding: str | None = None) -> None:
203203
except Exception:
204204
log.exception("Error setting key %s: %s", key)
205205

206-
def set_df_json(self, key: str, dataframe: Any) -> None:
206+
def _set_df_json(self, key: str, dataframe: Any) -> None:
207207
"""Set a json dataframe."""
208208
if self._connection_string is None and self._storage_account_name:
209209
dataframe.to_json(
@@ -225,7 +225,7 @@ def set_df_json(self, key: str, dataframe: Any) -> None:
225225
force_ascii=False,
226226
)
227227

228-
def set_df_parquet(self, key: str, dataframe: Any) -> None:
228+
def _set_df_parquet(self, key: str, dataframe: Any) -> None:
229229
"""Set a parquet dataframe."""
230230
if self._connection_string is None and self._storage_account_name:
231231
dataframe.to_parquet(

graphrag/storage/file_pipeline_storage.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ def find(
4747
def item_filter(item: dict[str, Any]) -> bool:
4848
if file_filter is None:
4949
return True
50-
5150
return all(re.match(value, item[key]) for key, value in file_filter.items())
5251

5352
search_path = Path(self._root_dir) / (base_dir or "")

tests/integration/storage/test_blob_pipeline_storage.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ async def test_find():
4444
output = await storage.get("test.txt")
4545
assert output is None
4646
finally:
47-
storage.delete_container()
47+
storage._delete_container() # noqa: SLF001
4848

4949

5050
async def test_dotprefix():
@@ -59,7 +59,7 @@ async def test_dotprefix():
5959
items = [item[0] for item in items]
6060
assert items == ["input/christmas.txt"]
6161
finally:
62-
storage.delete_container()
62+
storage._delete_container() # noqa: SLF001
6363

6464

6565
async def test_child():
@@ -93,4 +93,4 @@ async def test_child():
9393
has_test = await parent.has("input/test.txt")
9494
assert not has_test
9595
finally:
96-
parent.delete_container()
96+
parent._delete_container() # noqa: SLF001

tests/smoke/test_fixtures.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ async def prepare_azurite_data(input_path: str, azure: dict) -> Callable[[], Non
100100
container_name=input_container,
101101
)
102102
# Bounce the container if it exists to clear out old run data
103-
input_storage.delete_container()
104-
input_storage.create_container()
103+
input_storage._delete_container() # noqa: SLF001
104+
input_storage._create_container() # noqa: SLF001
105105

106106
# Upload data files
107107
txt_files = list((root / "input").glob("*.txt"))
@@ -116,7 +116,7 @@ async def prepare_azurite_data(input_path: str, azure: dict) -> Callable[[], Non
116116
)
117117
await input_storage.set(file_path, text, encoding="utf-8")
118118

119-
return lambda: input_storage.delete_container()
119+
return lambda: input_storage._delete_container() # noqa: SLF001
120120

121121

122122
class TestIndexer:

0 commit comments

Comments
 (0)