Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: add support for Windows and macOS #35

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 4 additions & 0 deletions checksitemap/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ def main():
sys.exit(1)
except KeyboardInterrupt:
sys.exit(-1)


if __name__ == '__main__':
main()
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