Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/geopython/OWSLib
Browse files Browse the repository at this point in the history
  • Loading branch information
geographika committed Oct 24, 2024
2 parents ac8c414 + d3a06d3 commit bb2ee62
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 5 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
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
- name: run tests ⚙️
run: python -m pytest
7 changes: 6 additions & 1 deletion owslib/wps.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
from owslib.namespaces import Namespaces
from urllib.parse import urlparse
import warnings
import os

# namespace definition
n = Namespaces()
Expand Down Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions tests/test_iso3_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit bb2ee62

Please sign in to comment.