Example #1
0
 def test_generate_docs(self):
     test_root = get_test_root()
     docs_root = os.path.join(test_root, "doc")
     generate.clean_generated_docs(docs_root)
     new_digest = self.check_generate_regenerate_cycle(test_root, INITIAL_FILESET)
     # touching an MD file under packages **does** cause a regenerate
     os.utime(os.path.join(test_root, "packages", "aardvark", "doc", "main.md"), None)
     new_digest = self.check_generate_regenerate_cycle(test_root, INITIAL_FILESET, new_digest)
     # touching a non MD file under packages **does not** cause a regenerate
     os.utime(os.path.join(test_root, "packages", "aardvark", "lib", "main.js"), None)
     self.check_generate_is_skipped(test_root, INITIAL_FILESET, new_digest)
     # touching a non MD file under static-files **does not** cause a regenerate
     os.utime(os.path.join(docs_root, "static-files", "another.html"), None)
     new_digest = self.check_generate_is_skipped(test_root, INITIAL_FILESET, new_digest)
     # touching an MD file under dev-guide **does** cause a regenerate
     os.utime(os.path.join(docs_root, "dev-guide-source", "index.md"), None)
     new_digest = self.check_generate_regenerate_cycle(test_root, INITIAL_FILESET, new_digest)
     # adding a file **does** cause a regenerate
     open(os.path.join(docs_root, "dev-guide-source", "extra.md"), "w").write("some content")
     new_digest = self.check_generate_regenerate_cycle(test_root, EXTENDED_FILESET, new_digest)
     # deleting a file **does** cause a regenerate
     os.remove(os.path.join(docs_root, "dev-guide-source", "extra.md"))
     new_digest = self.check_generate_regenerate_cycle(test_root, INITIAL_FILESET, new_digest)
     # remove the files
     generate.clean_generated_docs(docs_root)
Example #2
0
 def test_generate_static_docs(self):
     # make sure we start clean
     if os.path.exists(get_base_url_path()):
         shutil.rmtree(get_base_url_path())
     # generate a doc tarball, and extract it
     base_url = get_base_url()
     tar_filename = generate.generate_static_docs(env_root)
     tgz = tarfile.open(tar_filename)
     tgz.extractall(get_sdk_docs_root())
     broken_links = []
     # get each HTML file...
     for root, subFolders, filenames in os.walk(get_sdk_docs_root()):
         for filename in filenames:
             if not filename.endswith(".html"):
                 continue
             if root.endswith("static-files"):
                 continue
             filename = os.path.join(root, filename)
             # ...and feed it to the link checker
             linkChecker = Link_Checker(self, filename, base_url)
             linkChecker.feed(open(filename, "r").read())
             broken_links.extend(linkChecker.errors)
     if broken_links:
         print
         print "The following links are broken:"
         for broken_link in sorted(broken_links):
             print " "+ broken_link
         self.fail("%d links are broken" % len(broken_links))
     # clean up
     shutil.rmtree(get_base_url_path())
     tgz.close()
     os.remove(tar_filename)
     generate.clean_generated_docs(os.path.join(env_root, "doc"))
Example #3
0
 def test_generate_static_docs(self):
     # make sure we start clean
     if os.path.exists(get_base_url_path()):
         shutil.rmtree(get_base_url_path())
     # generate a doc tarball, and extract it
     base_url = get_base_url()
     tar_filename = generate.generate_static_docs(env_root)
     tgz = tarfile.open(tar_filename)
     tgz.extractall(get_sdk_docs_root())
     broken_links = []
     # get each HTML file...
     for root, subFolders, filenames in os.walk(get_sdk_docs_root()):
         for filename in filenames:
             if not filename.endswith(".html"):
                 continue
             if root.endswith("static-files"):
                 continue
             filename = os.path.join(root, filename)
             # ...and feed it to the link checker
             linkChecker = Link_Checker(self, filename, base_url)
             linkChecker.feed(open(filename, "r").read())
             broken_links.extend(linkChecker.errors)
     if broken_links:
         print
         print "The following links are broken:"
         for broken_link in sorted(broken_links):
             print " " + broken_link
         self.fail("%d links are broken" % len(broken_links))
     # clean up
     shutil.rmtree(get_base_url_path())
     tgz.close()
     os.remove(tar_filename)
     generate.clean_generated_docs(os.path.join(env_root, "doc"))
Example #4
0
 def test_generate_docs(self):
     test_root = get_test_root()
     docs_root = os.path.join(test_root, "doc")
     static_files_src = os.path.join(env_root, "doc", "static-files")
     static_files_dst = os.path.join(test_root, "doc", "static-files")
     if os.path.exists(static_files_dst):
         shutil.rmtree(static_files_dst)
     shutil.copytree(static_files_src, static_files_dst)
     generate.clean_generated_docs(docs_root)
     new_digest = self.check_generate_regenerate_cycle(test_root, INITIAL_FILESET)
     # touching an MD file under sdk **does** cause a regenerate
     os.utime(os.path.join(test_root, "doc", "module-source", "sdk", "aardvark-feeder.md"), None)
     new_digest = self.check_generate_regenerate_cycle(test_root, INITIAL_FILESET, new_digest)
     # touching a non MD file under sdk **does not** cause a regenerate
     os.utime(os.path.join(test_root, "doc", "module-source", "sdk", "not_a_doc.js"), None)
     self.check_generate_is_skipped(test_root, INITIAL_FILESET, new_digest)
     # touching a non MD file under static-files **does not** cause a regenerate
     os.utime(os.path.join(docs_root, "static-files", "css", "sdk-docs.css"), None)
     new_digest = self.check_generate_is_skipped(test_root, INITIAL_FILESET, new_digest)
     # touching an MD file under dev-guide **does** cause a regenerate
     os.utime(os.path.join(docs_root, "dev-guide-source", "index.md"), None)
     new_digest = self.check_generate_regenerate_cycle(test_root, INITIAL_FILESET, new_digest)
     # adding a file **does** cause a regenerate
     open(os.path.join(docs_root, "dev-guide-source", "extra.md"), "w").write("some content")
     new_digest = self.check_generate_regenerate_cycle(test_root, EXTENDED_FILESET, new_digest)
     # deleting a file **does** cause a regenerate
     os.remove(os.path.join(docs_root, "dev-guide-source", "extra.md"))
     new_digest = self.check_generate_regenerate_cycle(test_root, INITIAL_FILESET, new_digest)
     # remove the files
     generate.clean_generated_docs(docs_root)
     shutil.rmtree(static_files_dst)
Example #5
0
 def test_generate_docs(self):
     test_root = get_test_root()
     docs_root = os.path.join(test_root, "doc")
     static_files_src = os.path.join(env_root, "doc", "static-files")
     static_files_dst = os.path.join(test_root, "doc", "static-files")
     if os.path.exists(static_files_dst):
         shutil.rmtree(static_files_dst)
     shutil.copytree(static_files_src, static_files_dst)
     generate.clean_generated_docs(docs_root)
     new_digest = self.check_generate_regenerate_cycle(test_root, INITIAL_FILESET)
     # touching an MD file under sdk **does** cause a regenerate
     os.utime(os.path.join(test_root, "doc", "module-source", "sdk", "aardvark-feeder.md"), None)
     new_digest = self.check_generate_regenerate_cycle(test_root, INITIAL_FILESET, new_digest)
     # touching a non MD file under sdk **does not** cause a regenerate
     os.utime(os.path.join(test_root, "doc", "module-source", "sdk", "not_a_doc.js"), None)
     self.check_generate_is_skipped(test_root, INITIAL_FILESET, new_digest)
     # touching a non MD file under static-files **does not** cause a regenerate
     os.utime(os.path.join(docs_root, "static-files", "css", "sdk-docs.css"), None)
     new_digest = self.check_generate_is_skipped(test_root, INITIAL_FILESET, new_digest)
     # touching an MD file under dev-guide **does** cause a regenerate
     os.utime(os.path.join(docs_root, "dev-guide-source", "index.md"), None)
     new_digest = self.check_generate_regenerate_cycle(test_root, INITIAL_FILESET, new_digest)
     # adding a file **does** cause a regenerate
     open(os.path.join(docs_root, "dev-guide-source", "extra.md"), "w").write("some content")
     new_digest = self.check_generate_regenerate_cycle(test_root, EXTENDED_FILESET, new_digest)
     # deleting a file **does** cause a regenerate
     os.remove(os.path.join(docs_root, "dev-guide-source", "extra.md"))
     new_digest = self.check_generate_regenerate_cycle(test_root, INITIAL_FILESET, new_digest)
     # remove the files
     generate.clean_generated_docs(docs_root)
     shutil.rmtree(static_files_dst)
Example #6
0
 def test_generate_docs_does_not_smoke(self):
     test_root = os.path.join(env_root, "python-lib", "cuddlefish", "tests",
                              "static-files")
     docs_root = os.path.join(test_root, "doc")
     generate.clean_generated_docs(docs_root)
     new_digest = self.check_generate_regenerate_cycle(
         test_root, INITIAL_FILESET)
     # touching an MD file under packages **does** cause a regenerate
     os.utime(
         os.path.join(test_root, "packages", "aardvark", "doc", "main.md"),
         None)
     new_digest = self.check_generate_regenerate_cycle(
         test_root, INITIAL_FILESET, new_digest)
     # touching a non MD file under packages **does not** cause a regenerate
     os.utime(
         os.path.join(test_root, "packages", "aardvark", "lib", "main.js"),
         None)
     self.check_generate_is_skipped(test_root, INITIAL_FILESET, new_digest)
     # touching a non MD file under static-files **does not** cause a regenerate
     os.utime(os.path.join(docs_root, "static-files", "base.html"), None)
     new_digest = self.check_generate_is_skipped(test_root, INITIAL_FILESET,
                                                 new_digest)
     # touching an MD file under dev-guide **does** cause a regenerate
     os.utime(os.path.join(docs_root, "dev-guide-source", "welcome.md"),
              None)
     new_digest = self.check_generate_regenerate_cycle(
         test_root, INITIAL_FILESET, new_digest)
     # adding a file **does** cause a regenerate
     open(os.path.join(docs_root, "dev-guide-source", "extra.md"),
          "w").write("some content")
     new_digest = self.check_generate_regenerate_cycle(
         test_root, EXTENDED_FILESET, new_digest)
     # deleting a file **does** cause a regenerate
     os.remove(os.path.join(docs_root, "dev-guide-source", "extra.md"))
     new_digest = self.check_generate_regenerate_cycle(
         test_root, INITIAL_FILESET, new_digest)
     # remove the files
     generate.clean_generated_docs(docs_root)
Example #7
0
 def test_generate_static_docs(self):
     # make sure we start clean
     if os.path.exists(get_base_url_path()):
         shutil.rmtree(get_base_url_path())
     # generate a doc tarball, and extract it
     base_url = get_base_url()
     tar_filename = generate.generate_static_docs(env_root, base_url)
     tgz = tarfile.open(tar_filename)
     tgz.extractall(get_sdk_docs_root())
     # get each HTML file...
     for root, subFolders, filenames in os.walk(get_sdk_docs_root()):
         for filename in filenames:
             if not filename.endswith(".html"):
                 continue
             filename = os.path.join(root, filename)
             # ...and feed it to the link checker
             linkChecker = Link_Checker(self, filename, base_url)
             linkChecker.feed(open(filename, "r").read())
     # clean up
     shutil.rmtree(get_base_url_path())
     tgz.close()
     os.remove(tar_filename)
     generate.clean_generated_docs(os.path.join(env_root, "doc"))
Example #8
0
 def cleanup():
     shutil.rmtree(get_base_url_path())
     tgz.close()
     os.remove(tar_filename)
     generate.clean_generated_docs(os.path.join(env_root, "doc"))
Example #9
0
 def cleanup():
     shutil.rmtree(get_base_url_path())
     tgz.close()
     os.remove(tar_filename)
     generate.clean_generated_docs(os.path.join(env_root, "doc"))