Skip to content

Commit

Permalink
moved helper method extract_paths_from_metalink to tests/common.py
Browse files Browse the repository at this point in the history
  • Loading branch information
cehbrecht committed Nov 17, 2023
1 parent c9c78ed commit 99f890e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
10 changes: 8 additions & 2 deletions tests/common.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import os

# import tempfile

from jinja2 import Template
from pathlib import Path
from bs4 import BeautifulSoup
from pywps import get_ElementMakerForVersion
from pywps.app.basic import get_xpath_ns
from pywps.tests import WpsClient, WpsTestResponse
Expand Down Expand Up @@ -106,3 +105,10 @@ def get_output(doc):
output[identifier_el.text] = data_el[0].text

return output


def extract_paths_from_metalink(path):
path = path.replace("file://", "")
doc = BeautifulSoup(open(path, "r").read(), "xml")
paths = [el.text.replace("file://", "") for el in doc.find_all("metaurl")]
return paths
10 changes: 1 addition & 9 deletions tests/test_wps_average_weighted.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
import pytest

import xarray as xr
from bs4 import BeautifulSoup

from pywps import Service
from pywps.tests import assert_response_success, client_for

from rook.processes.wps_average_weighted import WeightedAverage

from .common import PYWPS_CFG, get_output


def extract_paths_from_metalink(path):
path = path.replace("file://", "")
doc = BeautifulSoup(open(path, "r").read(), "xml")
paths = [el.text.replace("file://", "") for el in doc.find_all("metaurl")]
return paths
from .common import PYWPS_CFG, get_output, extract_paths_from_metalink


def assert_weighted_average(path):
Expand Down

0 comments on commit 99f890e

Please sign in to comment.