Skip to content

Commit

Permalink
Pass CI testing
Browse files Browse the repository at this point in the history
  • Loading branch information
webb-ben committed Jan 17, 2024
1 parent a1a78d0 commit 153972c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 4 additions & 1 deletion sitemap_generator/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@
def write_tree(tree, file):
ET.register_namespace('', 'http://www.sitemaps.org/schemas/sitemap/0.9')
tree.write(file, **SITEMAP_ARGS)
ET._namespace_map.pop('http://www.sitemaps.org/schemas/sitemap/0.9')
try:
ET._namespace_map.pop('http://www.sitemaps.org/schemas/sitemap/0.9')
except KeyError:
print('No default namespace')


def get_smi():
Expand Down
10 changes: 5 additions & 5 deletions tests/test_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from datetime import datetime
from pathlib import Path
import xml.etree.ElementTree as ET
ET.register_namespace('', 'http://www.sitemaps.org/schemas/sitemap/0.9')

from sitemap_generator.handler.base import SITEMAP_DIR
from sitemap_generator.handler.filesystem import FileSystemHandler
Expand Down Expand Up @@ -62,11 +63,10 @@ def test_sitemapindex():
tree = ET.parse(sitemapindex)
root = tree.getroot()

assert all(child.tag == 'sitemap' for child in root)
assert all(URI_STEM in child.find('loc').text for child in root)

links = root.find('sitemap')
assert links.find('lastmod').text != today
assert all('sitemap' in child.tag for child in root)
for child in root:
assert URI_STEM in ''.join(child.itertext())
assert all(URI_STEM in ''.join(child.itertext()) for child in root)


def test_urlset():
Expand Down

0 comments on commit 153972c

Please sign in to comment.