From 6609af9b553ada1962cb6e7bef5db0d2cd273a4b Mon Sep 17 00:00:00 2001 From: Joachim Ungar Date: Thu, 7 Aug 2025 07:42:01 +0200 Subject: [PATCH 1/4] implement __eq__() so changing job states wouldn't consider two Job instances of the same job as different --- src/mapchete_hub_cli/job.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mapchete_hub_cli/job.py b/src/mapchete_hub_cli/job.py index a9ffabf..f41c6ef 100644 --- a/src/mapchete_hub_cli/job.py +++ b/src/mapchete_hub_cli/job.py @@ -73,6 +73,11 @@ def __repr__(self): # pragma: no cover def __hash__(self): return hash(self.job_id) + def __eq__(self, other): + if not isinstance(other, Job): + return False + return self.job_id == other.job_id + def _update(self, job: Job): self.status = job.status self._dict = job._dict From b0a0e6b1734571d8fa874d9d1d19e52858c2e75d Mon Sep 17 00:00:00 2001 From: Joachim Ungar Date: Thu, 7 Aug 2025 07:50:53 +0200 Subject: [PATCH 2/4] exclude line from test coverage --- src/mapchete_hub_cli/job.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mapchete_hub_cli/job.py b/src/mapchete_hub_cli/job.py index f41c6ef..fd322de 100644 --- a/src/mapchete_hub_cli/job.py +++ b/src/mapchete_hub_cli/job.py @@ -74,7 +74,7 @@ def __hash__(self): return hash(self.job_id) def __eq__(self, other): - if not isinstance(other, Job): + if not isinstance(other, Job): # pragma: no cover return False return self.job_id == other.job_id From 781d92f3d3a1db2c893980574198793dc24b4239 Mon Sep 17 00:00:00 2001 From: Joachim Ungar Date: Thu, 7 Aug 2025 07:55:33 +0200 Subject: [PATCH 3/4] remove shapely and tilematrix from optional dependencies --- pyproject.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2939325..af709f6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,8 +36,6 @@ dependencies = [ [project.optional-dependencies] zones = [ "mapchete", - "shapely", - "tilematrix" ] test = [ "mapchete_hub>=2023.12.0", From 59ae0f123ce84f276a5615cede1778911a28530e Mon Sep 17 00:00:00 2001 From: Joachim Ungar Date: Thu, 7 Aug 2025 08:26:25 +0200 Subject: [PATCH 4/4] disregard deprecated datetime usage --- tests/test_client.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/tests/test_client.py b/tests/test_client.py index 581eb1b..36b00ea 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -196,13 +196,15 @@ def test_list_jobs_from_date(mhub_client, example_config_json): ) ).job_id - now = datetime.datetime.utcfromtimestamp(time.time()).strftime("%Y-%m-%dT%H:%M:%SZ") + now = datetime.datetime.fromtimestamp(time.time(), datetime.timezone.utc).strftime( + "%Y-%m-%dT%H:%M:%SZ" + ) jobs = mhub_client.jobs(from_date=now) assert job_id in jobs - future = datetime.datetime.utcfromtimestamp(time.time() + 60).strftime( - "%Y-%m-%dT%H:%M:%SZ" - ) + future = datetime.datetime.fromtimestamp( + time.time() + 60, datetime.timezone.utc + ).strftime("%Y-%m-%dT%H:%M:%SZ") jobs = mhub_client.jobs(from_date=future) assert job_id not in jobs @@ -215,15 +217,15 @@ def test_list_jobs_to_date(mhub_client, example_config_json): ) ).job_id - now = datetime.datetime.utcfromtimestamp(time.time() + 60).strftime( - "%Y-%m-%dT%H:%M:%SZ" - ) + now = datetime.datetime.fromtimestamp( + time.time() + 60, datetime.timezone.utc + ).strftime("%Y-%m-%dT%H:%M:%SZ") jobs = mhub_client.jobs(to_date=now) assert job_id in jobs - past = datetime.datetime.utcfromtimestamp(time.time() - 60).strftime( - "%Y-%m-%dT%H:%M:%SZ" - ) + past = datetime.datetime.fromtimestamp( + time.time() - 60, datetime.timezone.utc + ).strftime("%Y-%m-%dT%H:%M:%SZ") jobs = mhub_client.jobs(to_date=past) assert job_id not in jobs