Skip to content

Commit

Permalink
FileStore: fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rkingsbury committed Apr 8, 2022
1 parent 1b04420 commit 038899a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/maggma/stores/file_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,11 @@ def read(self) -> List[Document]:
file_list = []
# generate a list of subdirectories
for f in [f for f in self.path.rglob("*")]:
if f.is_file() and any(
[fnmatch.fnmatch(f.name, fn) for fn in self.track_files]
):
print(f)
file_list.append(Document.from_file(f))
if f.is_file():
if f.name == self.json_name:
continue
elif any([fnmatch.fnmatch(f.name, fn) for fn in self.track_files]):
file_list.append(Document.from_file(f))

return file_list

Expand Down
8 changes: 4 additions & 4 deletions tests/stores/test_file_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ def test_newer_in_on_local_update(test_dir):
Init another FileStore on the same directory
confirm that one record shows up in newer_in
"""
fs = FileStore(test_dir)
fs = FileStore(test_dir, read_only=False)
fs.connect()
with open(test_dir / "calculation1" / "input.in", "w") as f:
f.write("Ryan was here")
fs2 = FileStore(test_dir)
fs2 = FileStore(test_dir, read_only=False)
fs2.connect()

assert fs2.last_updated > fs.last_updated
assert (
fs2.query_one({"dir_name": "calculation1"})["last_updated"]
> fs.query_one({"dir_name": "calculation1"})["last_updated"]
fs2.query_one({"path": {"$regex":"calculation1/input.in"}})["last_updated"]
> fs.query_one({"path":{"$regex":"calculation1/input.in"}})["last_updated"]
)
assert len(fs.newer_in(fs2)) == 1

0 comments on commit 038899a

Please sign in to comment.