Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-11-28 09:05:29 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-11-28 09:05:29 +0400
commit75ca7b85b5fb8d822ac8ea21f2d408d6ba3328f6 (patch)
tree29e020a043487dd5b836648d655edf523b790cee /source/tests
parentdc3f9b9c3ee64e2f98eba5eca882daf3035e0503 (diff)
Testing: added check for broken links to wiki docs
Diffstat (limited to 'source/tests')
-rw-r--r--source/tests/bl_rna_wiki_reference.py45
1 files changed, 42 insertions, 3 deletions
diff --git a/source/tests/bl_rna_wiki_reference.py b/source/tests/bl_rna_wiki_reference.py
index cfe7f22f7dd..634c4772cb7 100644
--- a/source/tests/bl_rna_wiki_reference.py
+++ b/source/tests/bl_rna_wiki_reference.py
@@ -87,18 +87,57 @@ def test_lookup_coverage():
print("%s.*" % rna_group)
-def test_urls():
+def test_language_coverage():
pass # TODO
-def test_language_coverage():
- pass # TODO
+def test_urls():
+ import sys
+ import rna_wiki_reference
+
+ import urllib.error
+ from urllib.request import urlopen
+
+ prefix = rna_wiki_reference.url_manual_prefix
+ urls = {suffix for (rna_id, suffix) in rna_wiki_reference.url_manual_mapping}
+
+ urls_len = "%d" % len(urls)
+ print("")
+ print("-------------" + "-" * len(urls_len))
+ print("Testing URLS %s" % urls_len)
+ print("")
+
+ color_red = '\033[0;31m'
+ color_green = '\033[1;32m' color_normal = '\033[0m'
+
+ urls_fail = []
+
+ for url in sorted(urls):
+ url_full = prefix + url
+ print(" %s ... " % url_full, end="")
+ sys.stdout.flush()
+ try:
+ urllib.request.urlopen(url_full)
+ print(color_green + "OK" + color_normal)
+ except urllib.error.HTTPError:
+ print(color_red + "FAIL!" + color_normal)
+ urls_fail.append(url)
+
+ if urls_fail:
+ urls_len = "%d" % len(urls)
+ print("")
+ print("------------" + "-" * len(urls_len))
+ print("Failed URLS %s" % urls_len)
+ print("")
+ for url in urls_fail:
+ print(" %s%s%s" % (color_red, url, color_normal))
def main():
test_data()
test_lookup_coverage()
test_language_coverage()
+ test_urls()
if __name__ == "__main__":
main()