Skip to content

Commit

Permalink
update CI (drop Python 3.7, add 3.10/3.11) (#891)
Browse files Browse the repository at this point in the history
* update CI (drop Python 3.7, add 3.10/3.11)

* move doctest to pytest

* fix test

* isolate extra checks to 3.8
  • Loading branch information
tomkralidis authored Sep 25, 2023
1 parent 94f3f41 commit 59ab2c3
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 62 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9']
python-version: ["3.8", "3.9", "3.10", "3.11"]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github
Expand All @@ -20,7 +20,7 @@ jobs:
- name: Install packages
run: |
sudo apt-get -y install pandoc
if: matrix.python-version == 3.7
if: matrix.python-version == 3.8
- name: Install requirements 📦
run: |
pip3 install -e .
Expand All @@ -31,10 +31,10 @@ jobs:
run: python3 -m pytest
- name: run coveralls ⚙️
run: coveralls
if: matrix.python-version == 3.7
if: matrix.python-version == 3.8
- name: build docs 🏗️
run: cd docs && make html
if: matrix.python-version == 3.7
if: matrix.python-version == 3.8
- name: run flake8 ⚙️
run: flake8 owslib
if: matrix.python-version == 3.7
if: matrix.python-version == 3.8
56 changes: 0 additions & 56 deletions tests/doctests/namespaces.txt

This file was deleted.

43 changes: 43 additions & 0 deletions tests/test_namespaces.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

import pytest

from owslib.namespaces import Namespaces

def test_namespaces():
ns = Namespaces()

assert ns.get_namespace('csw') == 'http://www.opengis.net/cat/csw/2.0.2'

x = ns.get_namespaces(['csw','gmd','fes'])
assert x == {'csw': 'http://www.opengis.net/cat/csw/2.0.2', 'fes': 'http://www.opengis.net/fes/2.0', 'gmd': 'http://www.isotc211.org/2005/gmd'}

ns.get_namespaces()

assert ns.get_versioned_namespace('ows') == 'http://www.opengis.net/ows'

assert ns.get_versioned_namespace('ows','1.0.0') == 'http://www.opengis.net/ows'

assert ns.get_versioned_namespace('ows','1.1.0') == 'http://www.opengis.net/ows/1.1'

assert ns.get_versioned_namespace('ows','2.0.0') == 'http://www.opengis.net/ows/2.0'

assert ns.get_namespaces('csw') == {'csw': 'http://www.opengis.net/cat/csw/2.0.2'}

assert ns.get_namespace('csw') == 'http://www.opengis.net/cat/csw/2.0.2'

assert ns.get_namespace('sa') == 'http://www.opengis.net/sampling/1.0'

# 'om300' does not exist as a namespace, so the below will return nothing
assert ns.get_namespace('om300') is None

# CSW 3.1.1 doesn't exist, so the below will return nothing
assert ns.get_versioned_namespace('csw','3.1.1') is None


# Invalid Usage Tests

with pytest.raises(TypeError):
ns.get_namespace()

with pytest.raises(TypeError):
ns.get_versioned_namespace()
2 changes: 1 addition & 1 deletion tests/test_wfs_postrequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class TestPostRequest_v_2_0_0():
def test_minimal_query(self, requestv200):
elem = requestv200._root.find(util.nspath("Query", WFS20_NAMESPACE))

assert elem.get("typenames") == typename
assert elem.get("typeNames") == typename

def test_basic_query(self, requestv200):
requestv200.set_maxfeatures(2)
Expand Down

0 comments on commit 59ab2c3

Please sign in to comment.