From d1e230bacf2115c68d875a58d4c4df7d3bec31e6 Mon Sep 17 00:00:00 2001 From: sethg Date: Thu, 24 Oct 2024 14:55:36 +0200 Subject: [PATCH 1/4] Ensure any starting slash on Windows is removed --- owslib/wps.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/owslib/wps.py b/owslib/wps.py index 950ebad1..cd250285 100644 --- a/owslib/wps.py +++ b/owslib/wps.py @@ -118,6 +118,7 @@ from owslib.namespaces import Namespaces from urllib.parse import urlparse import warnings +import os # namespace definition n = Namespaces() @@ -1446,7 +1447,11 @@ def retrieveData(self, username=None, password=None, headers=None, verify=True, # The link is a local file. # Useful when running local tests during development. if url.startswith("file://"): - with open(url[7:]) as f: + fn = url[7:] + # If on Windows and path starts with a '/', remove it + if os.name == 'nt' and fn.startswith('/'): + fn = fn[1:] + with open(fn) as f: return f.read() if '?' in url: From ed5993fe6adf2f0dd42bc367441833e9c0614b95 Mon Sep 17 00:00:00 2001 From: sethg Date: Thu, 24 Oct 2024 14:56:02 +0200 Subject: [PATCH 2/4] Open as utf-8 or tests fail on Windows --- tests/test_iso3_parsing.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_iso3_parsing.py b/tests/test_iso3_parsing.py index a1525281..7e121578 100644 --- a/tests/test_iso3_parsing.py +++ b/tests/test_iso3_parsing.py @@ -302,7 +302,7 @@ def bmd(): Source: https://metawal.wallonie.be/geonetwork """ belgian_sample = str(Path(__file__).parent.parent / "tests" / "resources" / "iso3_examples" / "metawal.wallonie.be-catchments.xml") - with open(belgian_sample, "r") as f_d: + with open(belgian_sample, "r", encoding="utf-8") as f_d: xml_list = f_d.readlines() xml_str = ''.join(xml_list) xml_bytes = bytes(xml_str, encoding='utf-8') @@ -462,7 +462,7 @@ def amd(): Source: https://portal.auscope.org.au/geonetwork """ aust_sample = str(Path(__file__).parent.parent / "tests" / "resources" / "iso3_examples" / "auscope-3d-model.xml") - with open(aust_sample, "r") as f_d: + with open(aust_sample, "r", encoding="utf-8") as f_d: xml_list = f_d.readlines() xml_str = ''.join(xml_list) xml_bytes = bytes(xml_str, encoding='utf-8') @@ -518,7 +518,7 @@ def smd(): Source: https://metawal.wallonie.be/geonetwork """ belgian_srv_sample = str(Path(__file__).parent.parent / "tests" / "resources" / "iso3_examples" / "metawal.wallonie.be-srv.xml") - with open(belgian_srv_sample, "r") as f_d: + with open(belgian_srv_sample, "r", encoding="utf-8") as f_d: xml_list = f_d.readlines() xml_str = ''.join(xml_list) xml_bytes = bytes(xml_str, encoding='utf-8') @@ -554,7 +554,7 @@ def emd(): Source: https://github.com/Esri/arcgis-pro-metadata-toolkit """ arcgis_sample = str(Path(__file__).parent.parent / "tests" / "resources" / "iso3_examples" / "arcgis-sample.xml") - with open(arcgis_sample, "r") as f_d: + with open(arcgis_sample, "r", encoding="utf-8") as f_d: xml_list = f_d.readlines() xml_str = ''.join(xml_list) xml_bytes = bytes(xml_str, encoding='utf-8') From e680b4723265ba0b5b40dfffb7ecb48d086bbead Mon Sep 17 00:00:00 2001 From: sethg Date: Thu, 24 Oct 2024 14:56:23 +0200 Subject: [PATCH 3/4] Add Windows workflow --- .github/workflows/windows.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/windows.yml diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 00000000..32ea6809 --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,26 @@ +name: build on Windows ⚙️ + +on: [ push, pull_request ] + +jobs: + main: + runs-on: windows-latest + strategy: + matrix: + python-version: ["3.11"] + steps: + - uses: actions/checkout@master + - uses: actions/setup-python@v5 + name: Setup Python ${{ matrix.python-version }} + with: + python-version: ${{ matrix.python-version }} + + - name: Install requirements 📦 + run: | + pip install -e . + pip install -r requirements.txt + pip install -r requirements-dev.txt + pip install -r docs/requirements.txt + + - name: run tests ⚙️ + run: python -m pytest From 096b3bdcfd2d5c6599d135de5ad3a57ba5062431 Mon Sep 17 00:00:00 2001 From: sethg Date: Thu, 24 Oct 2024 15:18:47 +0200 Subject: [PATCH 4/4] No need for docs requirements --- .github/workflows/windows.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 32ea6809..e6180ef2 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -20,7 +20,6 @@ jobs: pip install -e . pip install -r requirements.txt pip install -r requirements-dev.txt - pip install -r docs/requirements.txt - name: run tests ⚙️ run: python -m pytest