diff --git a/tests/common.py b/tests/common.py index e64a602..4c85a4e 100644 --- a/tests/common.py +++ b/tests/common.py @@ -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 @@ -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 diff --git a/tests/test_wps_average_weighted.py b/tests/test_wps_average_weighted.py index 4d5dd8d..ed3ab48 100644 --- a/tests/test_wps_average_weighted.py +++ b/tests/test_wps_average_weighted.py @@ -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):