aboutsummaryrefslogtreecommitdiff
path: root/test/requests/link_checker.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/requests/link_checker.py')
-rw-r--r--test/requests/link_checker.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/requests/link_checker.py b/test/requests/link_checker.py
index 64553ed8..715f330c 100644
--- a/test/requests/link_checker.py
+++ b/test/requests/link_checker.py
@@ -18,6 +18,10 @@ def is_internal_link(link):
pattern = re.compile("^/.*")
return pattern.match(link)
+def is_in_page_link(link):
+ pattern = re.compile("^#.*")
+ return pattern.match(link)
+
def get_links(doc):
return filter(
lambda x: not (
@@ -40,6 +44,7 @@ def verify_link(link):
else:
print("ERROR: link `"+link+"` failed with status "
, result.status_code)
+
if DO_FAIL:
raise Exception("Failed verify")
except ConnectionError as ex:
@@ -52,9 +57,10 @@ def check_page(host, start_url):
print("Checking links host "+host+" in page `"+start_url+"`")
doc = parse(start_url).getroot()
links = get_links(doc)
+ in_page_links = filter(is_in_page_link, links)
internal_links = filter(is_internal_link, links)
- external_links = filter(lambda x: not is_internal_link(x), links)
- # external_links.append("http://somenon-existentsite.brr")
+ external_links = filter(lambda x: not (is_internal_link(x) or is_in_page_link(x)), links)
+
for link in internal_links:
verify_link(host+link)