From b50ea55e8b10853fc16d684b454ad29b0f0e0097 Mon Sep 17 00:00:00 2001 From: Stefaan Lippens Date: Wed, 4 Sep 2024 09:14:50 +0200 Subject: [PATCH] Skip some job manager tests on python 3.7 no support for `shift` on `time_machine` fixture below python 3.8 refs #590, #596, #578 --- setup.py | 2 +- tests/extra/test_job_management.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index f4d7c2f7b..f1ddaf2ac 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ "matplotlib", "geopandas", "flake8>=5.0.0", - "time_machine>=2.13.0", + "time_machine", "pyproj>=3.2.0", # Pyproj is an optional, best-effort runtime dependency "dirty_equals>=0.6.0", # (#578) On Python 3.7: avoid dirty_equals 0.7.1 which wrongly claims to be Python 3.7 compatible diff --git a/tests/extra/test_job_management.py b/tests/extra/test_job_management.py index 07edafe92..22cc62ca5 100644 --- a/tests/extra/test_job_management.py +++ b/tests/extra/test_job_management.py @@ -1,6 +1,7 @@ import datetime import json import re +import sys import textwrap import threading import time @@ -509,6 +510,11 @@ def test_automatic_cancel_of_too_long_running_jobs( cancel_after_seconds, expected_status, ): + if not hasattr(time_machine, "shift"): + # TODO #578 remove this hack to skip this test on Python 3.7 + # `time_machine.shift` is only available since timemachine>=2.13.0, which only support Python 3.8 and up + pytest.skip("time_machine.shift not available") + fake_backend = FakeBackend(requests_mock=requests_mock) # For simplicity, set up pre-existing job with status "running" (instead of job manager creating+starting it)