Skip to content

Commit

Permalink
build: add support for Windows and macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
Jérôme Deuchnord committed May 13, 2022
1 parent 9e204b4 commit 2c01d27
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ on:

jobs:
tests:
name: Python ${{ matrix.python_version }}
runs-on: ubuntu-latest
name: Python ${{ matrix.python_version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
Expand All @@ -18,6 +18,10 @@ jobs:
- "3.8"
- "3.9"
- "3.10"
os:
- ubuntu-latest
- windows-latest
- macos-latest
steps:
- uses: actions/checkout@v3

Expand All @@ -29,9 +33,9 @@ jobs:

- name: Install dependencies
run: |
pip install -U pip poetry
poetry install
python3 -m pip install -U pip poetry
python3 -m poetry install
- name: Run Tests
run: |
poetry run pytest tests.py
python3 -m poetry run pytest tests.py
14 changes: 7 additions & 7 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from aurornis import run


def run_cmd(xml: str):
return run(["checksitemap", xml])
def run_cmd(path: str):
return run(["python3", "-m", "checksitemap", path], normalize_carriage_return=True)


def test_check_valid_sitemap_from_local_file():
Expand All @@ -15,7 +15,7 @@ def test_check_valid_sitemap_from_local_file():


def test_check_invalid_sitemap_from_local_file_missing_namespace():
result = run_cmd(f"test_assets/invalid_sitemap_missing_namespace.xml")
result = run_cmd("test_assets/invalid_sitemap_missing_namespace.xml")
assert not result.is_successful()
assert (
result.stderr == "Warning: missing XML namespace on <urlset> tag: "
Expand All @@ -25,21 +25,21 @@ def test_check_invalid_sitemap_from_local_file_missing_namespace():


def test_check_invalid_sitemap_from_local_file_invalid_tag():
result = run_cmd(f"test_assets/invalid_sitemap_invalid_tag.xml")
result = run_cmd("test_assets/invalid_sitemap_invalid_tag.xml")
assert not result.is_successful()
assert result.stderr == "Error: invalid <is_a_cool_page> tag for URL n°1!\n"
assert result.stdout == "\n2 of 3 URLs (66%) passed.\n"


def test_check_invalid_sitemap_from_local_file_missing_loc():
result = run_cmd(f"test_assets/invalid_sitemap_missing_loc.xml")
result = run_cmd("test_assets/invalid_sitemap_missing_loc.xml")
assert not result.is_successful()
assert result.stderr == "Error: URL n°1 has no mandatory <loc> tag!\n"
assert result.stdout == "\n2 of 3 URLs (66%) passed.\n"


def test_check_invalid_sitemap_from_local_file_invalid_priority():
result = run_cmd(f"test_assets/invalid_sitemap_invalid_priority.xml")
result = run_cmd("test_assets/invalid_sitemap_invalid_priority.xml")
assert not result.is_successful()
assert (
result.stderr
Expand All @@ -49,7 +49,7 @@ def test_check_invalid_sitemap_from_local_file_invalid_priority():


def test_check_invalid_sitemap_from_local_file_changefreq():
result = run_cmd(f"test_assets/invalid_sitemap_changefreq.xml")
result = run_cmd("test_assets/invalid_sitemap_changefreq.xml")
assert not result.is_successful()
assert (
result.stderr
Expand Down

0 comments on commit 2c01d27

Please sign in to comment.