Skip to content

Commit

Permalink
modified method functionality added (#44)
Browse files Browse the repository at this point in the history
Co-authored-by: Ruslan Kuprieiev <[email protected]>
  • Loading branch information
benrutter and efiop authored Apr 22, 2024
1 parent 807e00b commit 8b9fe85
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sshfs/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ async def _info(self, path, **kwargs):
info["name"] = path
return info

@wrap_exceptions
async def _modified(self, path: str, **kwargs) -> datetime:
path_info = await self._info(path)
return path_info["mtime"]

modified = sync_wrapper(_modified)

@wrap_exceptions
async def _mv(self, lpath, rpath, **kwargs):
async with self._pool.get() as channel:
Expand Down
6 changes: 6 additions & 0 deletions tests/test_sshfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import tempfile
import warnings
from concurrent import futures
from datetime import datetime
from pathlib import Path

import fsspec
Expand Down Expand Up @@ -339,6 +340,11 @@ def test_concurrency_for_raw_commands(fs, remote_dir):
future.result()


def test_modified(fs, remote_dir):
modified = fs.modified(remote_dir)
assert isinstance(modified, datetime)


def test_cat_file_sync(fs, remote_dir):
# Define the content to write to the test file
test_content = b"Test content for cat_file"
Expand Down

0 comments on commit 8b9fe85

Please sign in to comment.