def test_server_start_run(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") path = os.path.abspath(os.path.split(__file__)[0]) data = os.path.join(path, "data") server = 'localhost' thread = run_doc_server(server, {"pyquickhelper": data}, True, port=8094) url = "http://localhost:8094/pyquickhelper/" cont = get_url_content(url) self.assertNotEmpty(cont) self.assertIn("GitHub/pyquickhelper</a>", cont) fLOG("-------") url = "http://localhost:8094/pyquickhelper/search.html?q=flog&check_keywords=yes&area=default" cont = get_url_content(url) self.assertNotEmpty(cont) self.assertIn("Please activate JavaScript to enable the search", cont) self.assertIn("http://sphinx.pocoo.org/", cont) cont = get_url_content(url, True) self.assertNotEmpty(cont) self.assertIn("Please activate JavaScript to enable the search", cont) self.assertIn("http://sphinx.pocoo.org/", cont) thread.shutdown() if thread.is_alive(): fLOG("thread is still alive?", thread.is_alive()) assert False
def test_server_start_run(self): if sys.version_info[0] == 2: return if is_travis_or_appveyor() == "appveyor": return fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") path = os.path.abspath(os.path.split(__file__)[0]) data = os.path.join(path, "data") server = 'localhost' thread = run_doc_server( server, { "pyquickhelper": data}, True, port=8094) url = "http://localhost:8094/pyquickhelper/" cont = get_url_content(url) assert len(cont) > 0 assert "GitHub/pyquickhelper</a>" in cont fLOG("-------") url = "http://localhost:8094/pyquickhelper/search.html?q=flog&check_keywords=yes&area=default" cont = get_url_content(url) assert len(cont) > 0 assert "Please activate JavaScript to enable the search" in cont assert "http://sphinx.pocoo.org/" in cont cont = get_url_content(url, True) assert len(cont) > 0 assert "Please activate JavaScript to enable the search" in cont assert "http://sphinx.pocoo.org/" in cont thread.shutdown() if thread.is_alive(): fLOG("thread is still alive?", thread.is_alive()) assert False
try: import pyquickhelper except ImportError: import sys sys.path.append(r"../pyquickhelper/src") import pyquickhelper import os from pyquickhelper.serverdoc import run_doc_server mappings = {} fold = os.path.abspath(os.path.dirname(__file__)) fold = os.path.normpath(os.path.join(fold, "..")) for project in os.listdir(fold): full = os.path.join(fold, project) if os.path.isdir(full): for i in ["", "2", "3"]: doc = os.path.join(full, "dist", "html" + i) if os.path.exists(doc): mappings[project + i] = doc print("add ", project + i, " --> ", doc) print("running run_doc_server") run_doc_server("localhost", mappings=mappings, port=8887)