Skip to content

Commit

Permalink
tests: fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-c committed Oct 12, 2023
1 parent 31ded51 commit c73e1f7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
8 changes: 5 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,24 @@

# -- Path setup --------------------------------------------------------------

import importlib.metadata
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
from datetime import datetime
import time
import importlib.metadata
from datetime import datetime, timezone

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


# -- Project information -----------------------------------------------------

build_date = datetime.utcfromtimestamp(int(os.environ.get("SOURCE_DATE_EPOCH", time.time())))
build_date = datetime.fromtimestamp(
int(os.environ.get("SOURCE_DATE_EPOCH", time.time())), timezone.utc
)
project = "Common Workflow Language reference implementation"
copyright = f"2019 — {build_date.year}, Peter Amstutz and contributors to the CWL Project"
author = "Peter Amstutz and Common Workflow Language Project contributors"
Expand Down
13 changes: 6 additions & 7 deletions tests/test_mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from pathlib import Path
from typing import Any, Generator, List, MutableMapping, Optional, Tuple

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


mpiReq = CommentedMap({"class": MPIRequirementName, "processes": 1})
Expand Down
4 changes: 2 additions & 2 deletions tests/test_path_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def test_unicode_in_output_files(tmp_path: Path, filename: str) -> None:
assert main(params) == 0


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

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

result = cast(
CWLObjectType,
Expand Down

0 comments on commit c73e1f7

Please sign in to comment.