diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f8f78f2..9f1c242 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,8 +18,8 @@ jobs: fail-fast: true matrix: - os: [ubuntu-latest, macos-latest] - pyv: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] + os: [ubuntu-latest] + pyv: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14","3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14","3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14","3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14","3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14","3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14","3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14","3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14","3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14","3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14","3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14","3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14","3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14","3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14","3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14","3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14","3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14","3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14","3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14","3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14","3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14","3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14","3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14","3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14","3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14","3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] steps: - uses: actions/checkout@v4 @@ -34,6 +34,7 @@ jobs: python -m pip install -e . - name: Test + timeout-minutes: 2 run: python -m pytest --cov-report=xml --cov=. - name: Upload coverage to Codecov diff --git a/requirements-dev.txt b/requirements-dev.txt index 1b4add2..844661d 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,5 +1,5 @@ pytest pytest-asyncio pytest-cov -mock-ssh-server +mock-ssh-server @ git+https://github.com/skshetry/mock-ssh-server.git@command-queue-race importlib-metadata >= 6.0.0 diff --git a/tests/test_sshfs.py b/tests/test_sshfs.py index 1a13dc2..1a9ec14 100644 --- a/tests/test_sshfs.py +++ b/tests/test_sshfs.py @@ -4,11 +4,12 @@ import tempfile import warnings from concurrent import futures -from datetime import datetime +from datetime import datetime, timedelta from pathlib import Path import fsspec import pytest +from _pytest.python_api import ApproxBase from asyncssh.sftp import SFTPFailure from importlib_metadata import entry_points @@ -17,7 +18,16 @@ _STATIC = (Path(__file__).parent / "static").resolve() USERS = {"user": _STATIC / "user.key"} -DEVIATION = 5 + +class approx_datetime(ApproxBase): + def __init__(self, expected, abs=1): + super().__init__(expected, abs=timedelta(seconds=abs)) + + def __repr__(self): + return f"approx_datetime({self.expected!r} ± {self.abs!r})" + + def __eq__(self, actual): + return abs(self.expected - actual) <= self.abs @pytest.fixture(scope="session") @@ -128,6 +138,12 @@ def test_move(fs, remote_dir): initial_info.pop("name") secondary_info.pop("name") + assert initial_info.pop("time") == approx_datetime( + secondary_info.pop("time") + ) + assert initial_info.pop("mtime") == approx_datetime( + secondary_info.pop("mtime") + ) assert initial_info == secondary_info