Skip to content

Commit

Permalink
linting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeitsperre committed Oct 23, 2024
1 parent de6977f commit d2cff18
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
17 changes: 7 additions & 10 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
xpath_ns = get_xpath_ns(VERSION)

TESTS_HOME = Path(__file__).parent.absolute()
ROOCS_CFG = os.path.join(TESTS_HOME, ".roocs.ini")
ROOCS_CFG = TESTS_HOME.joinpath(".roocs.ini")


@pytest.fixture(scope="session")
Expand Down Expand Up @@ -69,10 +69,10 @@ def write_roocs_cfg(stratus):
base_dir = {{ base_dir }}/test_data/pool/data/c3s-cica-atlas
""" # noqa
cfg = Template(cfg_templ).render(base_dir=stratus.path)
with open(ROOCS_CFG, "w") as fp:
with ROOCS_CFG.open("w") as fp:
fp.write(cfg)
# point to roocs cfg in environment
os.environ["ROOCS_CONFIG"] = ROOCS_CFG
os.environ["ROOCS_CONFIG"] = ROOCS_CFG.as_posix()


@pytest.fixture
Expand All @@ -93,7 +93,7 @@ def extract_paths_from_metalink():

def _extract_paths_from_metalink(path):
path = path.replace("file://", "")
doc = BeautifulSoup(open(path).read(), "xml")
doc = BeautifulSoup(Path(path).open().read(), "xml")
paths = [el.text.replace("file://", "") for el in doc.find_all("metaurl")]
return paths

Expand All @@ -105,7 +105,7 @@ def parse_metalink():

def _parse_metalink(xml):
xml_ = xml.replace(' xmlns="', ' xmlnamespace="')
tree = etree.fromstring(xml_.encode())
tree = etree.fromstring(xml_.encode()) # noqa: S320
urls = [m.text for m in tree.xpath("//metaurl")]
return urls

Expand Down Expand Up @@ -159,10 +159,7 @@ def _get_output(doc):

@pytest.fixture(scope="session", autouse=True)
def load_test_data(stratus):
"""
This fixture ensures that the required test data repository
has been cloned to the cache directory within the home directory.
"""
"""Ensure that the required test data repository has been cloned to the cache directory within the home directory."""
repositories = {
"stratus": {
"worker_cache_dir": stratus.path,
Expand All @@ -172,7 +169,7 @@ def load_test_data(stratus):
},
}

for name, repo in repositories.items():
for repo in repositories.values():
gather_testing_data(worker_id="master", **repo)


Expand Down
4 changes: 2 additions & 2 deletions tests/smoke/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def server_url():

def parse_metalink(xml):
xml_ = xml.replace(' xmlns="', ' xmlnamespace="')
tree = etree.fromstring(xml_.encode())
tree = etree.fromstring(xml_.encode()) # noqa: S320
urls = [m.text for m in tree.xpath("//metaurl")]
return urls

Expand All @@ -42,7 +42,7 @@ def execute(self, identifier, inputs):
assert execution.isSucceded() is True
assert len(execution.processOutputs) > 0
ml_url = execution.processOutputs[0].reference
xml = requests.get(ml_url).text
xml = requests.get(ml_url, timeout=30).text
urls = parse_metalink(xml)
return urls

Expand Down
4 changes: 2 additions & 2 deletions tests/storm/common/wps.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os
from pathlib import Path
import time
from urllib.parse import urlparse

Expand All @@ -7,7 +7,7 @@
from jinja2 import Environment, FileSystemLoader
from pyquery import PyQuery

templates_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), "templates")
templates_path = Path(__file__).absolute().joinpath("templates")
template_env = Environment(loader=FileSystemLoader(templates_path), autoescape=True)


Expand Down

0 comments on commit d2cff18

Please sign in to comment.