Skip to content

Commit c73e1f7

Browse files
committed
tests: fix warnings
1 parent 31ded51 commit c73e1f7

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

docs/conf.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,24 @@
66

77
# -- Path setup --------------------------------------------------------------
88

9+
import importlib.metadata
910
# If extensions (or modules to document with autodoc) are in another directory,
1011
# add these directories to sys.path here. If the directory is relative to the
1112
# documentation root, use os.path.abspath to make it absolute, like shown here.
1213
#
1314
import os
1415
import sys
15-
from datetime import datetime
1616
import time
17-
import importlib.metadata
17+
from datetime import datetime, timezone
1818

1919
sys.path.insert(0, os.path.abspath(".."))
2020

2121

2222
# -- Project information -----------------------------------------------------
2323

24-
build_date = datetime.utcfromtimestamp(int(os.environ.get("SOURCE_DATE_EPOCH", time.time())))
24+
build_date = datetime.fromtimestamp(
25+
int(os.environ.get("SOURCE_DATE_EPOCH", time.time())), timezone.utc
26+
)
2527
project = "Common Workflow Language reference implementation"
2628
copyright = f"2019 — {build_date.year}, Peter Amstutz and contributors to the CWL Project"
2729
author = "Peter Amstutz and Common Workflow Language Project contributors"

tests/test_mpi.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
from pathlib import Path
77
from typing import Any, Generator, List, MutableMapping, Optional, Tuple
88

9-
import pkg_resources
109
import pytest
10+
from importlib_resources import files
1111
from ruamel.yaml.comments import CommentedMap, CommentedSeq
1212
from schema_salad.avro.schema import Names
1313
from schema_salad.utils import yaml_no_ts
@@ -281,12 +281,11 @@ def test_env_passing(monkeypatch: pytest.MonkeyPatch) -> None:
281281
# Reading the schema is super slow - cache for the session
282282
@pytest.fixture(scope="session")
283283
def schema_ext11() -> Generator[Names, None, None]:
284-
with pkg_resources.resource_stream("cwltool", "extensions-v1.1.yml") as res:
285-
ext11 = res.read().decode("utf-8")
286-
cwltool.process.use_custom_schema("v1.1", "http://commonwl.org/cwltool", ext11)
287-
schema = cwltool.process.get_schema("v1.1")[1]
288-
assert isinstance(schema, Names)
289-
yield schema
284+
ext11 = files("cwltool").joinpath("extensions-v1.1.yml").read_text("utf-8")
285+
cwltool.process.use_custom_schema("v1.1", "http://commonwl.org/cwltool", ext11)
286+
schema = cwltool.process.get_schema("v1.1")[1]
287+
assert isinstance(schema, Names)
288+
yield schema
290289

291290

292291
mpiReq = CommentedMap({"class": MPIRequirementName, "processes": 1})

tests/test_path_checks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def test_unicode_in_output_files(tmp_path: Path, filename: str) -> None:
107107
assert main(params) == 0
108108

109109

110-
class TestFsAccess(StdFsAccess):
110+
class StubFsAccess(StdFsAccess):
111111
"""Stub fs access object that doesn't rely on the filesystem."""
112112

113113
def glob(self, pattern: str) -> List[str]:
@@ -195,7 +195,7 @@ def test_clt_returns_specialchar_names(tmp_path: Path) -> None:
195195
builder.files, builder.stagedir, RuntimeContext(), True
196196
)
197197
builder.outdir = "/var/spool/cwl"
198-
fs_access = TestFsAccess("")
198+
fs_access = StubFsAccess("")
199199

200200
result = cast(
201201
CWLObjectType,

0 commit comments

Comments
 (0)