def test_notebook_runner(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") temp = get_temp_folder(__file__, "temp_notebook2a_1") keepnote = ls_notebooks("td2a") assert len(keepnote) > 0 res = execute_notebooks(temp, keepnote, lambda i, n: "_1" in n, fLOG=fLOG) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_2a(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") if is_travis_or_appveyor() == "appveyor": # too long for appveyor return from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_1a, unittest_raise_exception_notebook temp = get_temp_folder(__file__, "temp_notebook2a_") keepnote = ls_notebooks("2a") assert len(keepnote) > 0 def filter(i, n): if not sys.platform.startswith("win") and "_convert" in n: return False if "git_" not in n and "python_r" not in n and "csharp" not in n: return True if is_travis_or_appveyor() and "notebook_convert.ipynb" in n: # this one requires pandoc return False return False if is_travis_or_appveyor() == "travis": warnings.warn("execution does not stop") return res = execute_notebooks(temp, keepnote, filter, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") # this notebook describes how to distribute the work with multiple processors # it requires to start multiple clusters first (a command line) # and to stop them afterwards # it still needs to be implemented # we skip ! warnings.warn( "TODO: implement a unit test testing the distribution on multiple processors" ) return temp = get_temp_folder(__file__, "temp_notebook2a_2_enonce_2D") keepnote = ls_notebooks("td2a") assert len(keepnote) > 0 res = execute_notebooks( temp, keepnote, lambda i, n: "_2" in n and "enonce" in n and "_2D" in n, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def common_notebook_runner_2a_eco_nlp_enonce(self, sub): from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_1a, unittest_raise_exception_notebook temp = get_temp_folder(__file__, "temp_notebook2a_eco_nlp_" + sub) keepnote = ls_notebooks("td2a_eco") assert len(keepnote) > 0 if sub == "correction": folder = os.path.join(temp, "ressources_googleplus") os.mkdir(folder) folder_note = os.path.split(keepnote[0])[0] jsfile = os.path.join( folder_note, "ressources_googleplus", "107033731246200681024.json") shutil.copy(jsfile, folder) def filter(i, n): if "Traitement_automatique" not in n: return False if sub == "enonce": if "correction" in n: return False elif sub not in n: return False return True res = execute_notebooks(temp, keepnote, filter, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_2a_long(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") if "travis" in sys.executable: # skip travis and R warnings.warn( "travis, unable to test TestNotebookRunner2a_long.test_notebook_runner_2a_long" ) return if "R_HOME" not in os.environ or not os.path.exists( os.environ["R_HOME"]): paths = [ r"C:\Program Files\R\R-3.2.2", r"C:\Program Files\R\R-3.1.2" ] for path in paths: if os.path.exists(path): os.environ["R_HOME"] = path break temp = get_temp_folder(__file__, "temp_notebook2a_long_") keepnote = ls_notebooks("2a") assert len(keepnote) > 0 res = execute_notebooks(temp, keepnote, lambda i, n: "python_r" in n, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_correction_1_7(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_1a, unittest_raise_exception_notebook temp = get_temp_folder(__file__, "temp_notebook1a_correction_1_7") keepnote = ls_notebooks("td1a") assert len(keepnote) > 0 cp = os.path.join(temp, "..", "data", "seance4_excel.txt") shutil.copy(cp, temp) cp = os.path.join(temp, "..", "data", "seance4_excel.xlsx") shutil.copy(cp, temp) res = execute_notebooks(temp, keepnote, lambda i, n: "_12" not in n and "session6." not in n and "session8." not in n and "session9." not in n and "session_10." not in n and "session_11." not in n and "correction" in n, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_2a_eco_sncf(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_1a, unittest_raise_exception_notebook from src.ensae_teaching_cs.data import simple_database temp = get_temp_folder(__file__, "temp_notebook2a_eco_sncf") keepnote = ls_notebooks("td2a_eco") assert len(keepnote) > 0 shutil.copy(simple_database(), temp) folder_note = os.path.split(keepnote[0])[0] jsfile = os.path.join(folder_note, "stop_areas.json") shutil.copy(jsfile, temp) def filter(i, n): if "SNCF" not in n: return False return True if is_travis_or_appveyor() == "travis": warnings.warn("execution does not stop") return res = execute_notebooks(temp, keepnote, filter, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_2a_eco_scraping(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") if is_travis_or_appveyor() == "appveyor": # too long for appveyor return from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_1a, unittest_raise_exception_notebook from src.ensae_teaching_cs.data import simple_database temp = get_temp_folder(__file__, "temp_notebook2a_eco_scraping") keepnote = ls_notebooks("td2a_eco") assert len(keepnote) > 0 shutil.copy(simple_database(), temp) def filter(i, n): if "Scraping" not in n: return False return True if is_travis_or_appveyor() == "travis": warnings.warn("execution does not stop") return res = execute_notebooks(temp, keepnote, filter, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_2a(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") if is_travis_or_appveyor() == "appveyor": # too long for appveyor return from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_1a, unittest_raise_exception_notebook temp = get_temp_folder(__file__, "temp_notebook2a_") keepnote = ls_notebooks("2a") assert len(keepnote) > 0 def filter(i, n): if not sys.platform.startswith("win") and "_convert" in n: return False if "git_" not in n and "python_r" not in n and "csharp" not in n: return True if is_travis_or_appveyor() and "notebook_convert.ipynb" in n: # this one requires pandoc return False return False if is_travis_or_appveyor() == "travis": warnings.warn("execution does not stop") return res = execute_notebooks(temp, keepnote, filter, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def common_notebook_runner_2a_eco_nlp_enonce(self, sub): from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_1a, unittest_raise_exception_notebook temp = get_temp_folder(__file__, "temp_notebook2a_eco_nlp_" + sub) keepnote = ls_notebooks("td2a_eco") assert len(keepnote) > 0 if sub == "correction": folder = os.path.join(temp, "ressources_googleplus") os.mkdir(folder) folder_note = os.path.split(keepnote[0])[0] jsfile = os.path.join(folder_note, "ressources_googleplus", "107033731246200681024.json") shutil.copy(jsfile, folder) def filter(i, n): if "Traitement_automatique" not in n: return False if sub == "enonce": if "correction" in n: return False elif sub not in n: return False return True res = execute_notebooks(temp, keepnote, filter, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_2a_long(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") if "travis" in sys.executable: # skip travis and R warnings.warn( "travis, unable to test TestNotebookRunner2a_long.test_notebook_runner_2a_long") return if "R_HOME" not in os.environ or not os.path.exists(os.environ["R_HOME"]): paths = [r"C:\Program Files\R\R-3.2.2", r"C:\Program Files\R\R-3.1.2"] for path in paths: if os.path.exists(path): os.environ["R_HOME"] = path break temp = get_temp_folder(__file__, "temp_notebook2a_long_") keepnote = ls_notebooks("2a") assert len(keepnote) > 0 res = execute_notebooks(temp, keepnote, lambda i, n: "python_r" in n, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_long_notebook_runner_2a_ml(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") if is_travis_or_appveyor() == "appveyor": # too long for appveyor return from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_1a, unittest_raise_exception_notebook from src.ensae_teaching_cs.data import simple_database temp = get_temp_folder(__file__, "temp_notebook2a_eco") keepnote = ls_notebooks("td2a_ml") assert len(keepnote) > 0 shutil.copy(simple_database(), temp) def filter(i, n): if "deep_python" in n: return True return False if is_travis_or_appveyor() == "travis": warnings.warn("execution does not stop") return res = execute_notebooks(temp, keepnote, filter, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") temp = get_temp_folder(__file__, "temp_notebook2a_2_corection_2B") keepnote = ls_notebooks("td2a") assert len(keepnote) > 0 res = execute_notebooks(temp, keepnote, lambda i, n: "_2" in n and "correction" in n and "_2B" in n, fLOG=fLOG) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, unittest_raise_exception_notebook temp = get_temp_folder(__file__, "temp_notebook2a_2_corection_2B") keepnote = ls_notebooks("td2a") assert len(keepnote) > 0 res = execute_notebooks(temp, keepnote, lambda i, n: "_2" in n and "correction" in n and "_2B" in n, fLOG=fLOG) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_exams(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") temp = get_temp_folder(__file__, "temp_notebookexams_") keepnote = ls_notebooks("exams") assert len(keepnote) > 0 res = execute_notebooks(temp, keepnote, lambda i, n: "git" not in n and "interro_rapide_20_minutes_2014_11" not in n, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_correction(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, unittest_raise_exception_notebook, clean_function_1a temp = get_temp_folder(__file__, "temp_notebook2a_3A_correction") keepnote = ls_notebooks("td2a_ml") assert len(keepnote) > 0 res = execute_notebooks(temp, keepnote, lambda i, n: "_3A" in n and "correction" in n, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_correction_8(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") temp = get_temp_folder(__file__, "temp_notebook1a_correction_8") keepnote = ls_notebooks("td1a") assert len(keepnote) > 0 res = execute_notebooks(temp, keepnote, lambda i, n: "correction_session8." in n, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_1a(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") temp = get_temp_folder(__file__, "temp_notebook1a_") keepnote = ls_notebooks("1a") assert len(keepnote) > 0 res = execute_notebooks(temp, keepnote, lambda i, n: "deviner" not in n, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_correction_11(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") temp = get_temp_folder(__file__, "temp_notebook1a_correction_11") keepnote = ls_notebooks("td1a") assert len(keepnote) > 0 res = execute_notebooks(temp, keepnote, lambda i, n: "correction_session_11" in n, fLOG=fLOG, clean_function=TestNotebookRunner1a_correction_11.clean_function) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, unittest_raise_exception_notebook temp = get_temp_folder(__file__, "temp_notebook2a_6") keepnote = ls_notebooks("td2a") assert len(keepnote) > 0 res = execute_notebooks(temp, keepnote, lambda i, n: "_6" in n, fLOG=fLOG) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_enonce(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, unittest_raise_exception_notebook, clean_function_1a temp = get_temp_folder(__file__, "temp_notebook2a_3A_enonce") keepnote = ls_notebooks("td2a_ml") assert len(keepnote) > 0 res = execute_notebooks( temp, keepnote, lambda i, n: "_3A" in n and "enonce" in n, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_exposelong3(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") temp = get_temp_folder(__file__, "temp_notebookexposelong3_") keepnote = ls_notebooks("expose") assert len(keepnote) > 0 res = execute_notebooks(temp, keepnote, lambda i, n: "mortalite" in n, fLOG=fLOG, deepfLOG=fLOG if __name__ == "__main__" else noLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_expose1(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") temp = get_temp_folder(__file__, "temp_notebookexpose1_") keepnote = ls_notebooks("expose") assert len(keepnote) > 0 res = execute_notebooks(temp, keepnote, lambda i, n: "velib" not in n and "paris_parcours" not in n and "ml_table_mortalite" not in n, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_enonce_12(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") temp = get_temp_folder(__file__, "temp_notebook1a_enonce_12") keepnote = ls_notebooks("td1a") assert len(keepnote) > 0 res = execute_notebooks(temp, keepnote, lambda i, n: "cenonce_session_12" in n, fLOG=fLOG, deepfLOG=fLOG if __name__ == "__main__" else noLOG, clean_function=TestNotebookRunner1a_enonce_12.clean_function) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_exams(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_1a, unittest_raise_exception_notebook temp = get_temp_folder(__file__, "temp_notebookexams_") keepnote = ls_notebooks("exams") assert len(keepnote) > 0 res = execute_notebooks(temp, keepnote, lambda i, n: "git_" not in n and "interro_rapide_20_minutes_2014_11" not in n, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_enonce_10(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") temp = get_temp_folder(__file__, "temp_notebook1a_enonce_10") from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_1a, unittest_raise_exception_notebook keepnote = ls_notebooks("td1a") assert len(keepnote) > 0 res = execute_notebooks(temp, keepnote, lambda i, n: "cenonce_session_10." in n, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_exposelong1(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_1a, unittest_raise_exception_notebook temp = get_temp_folder(__file__, "temp_notebookexposelong1_") keepnote = ls_notebooks("expose") assert len(keepnote) > 0 res = execute_notebooks(temp, keepnote, lambda i, n: "velib" in n, fLOG=fLOG, deepfLOG=fLOG if __name__ == "__main__" else noLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_exposelong1(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") temp = get_temp_folder(__file__, "temp_notebookexposelong1_") keepnote = ls_notebooks("expose") assert len(keepnote) > 0 res = execute_notebooks( temp, keepnote, lambda i, n: "velib" in n, fLOG=fLOG, deepfLOG=fLOG if __name__ == "__main__" else noLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks from src.ensae_teaching_cs.automation.notebook_test_helper import unittest_raise_exception_notebook, clean_function_1a temp = get_temp_folder(__file__, "temp_notebook2a_1") keepnote = ls_notebooks("competitions/2016") assert len(keepnote) > 0 res = execute_notebooks(temp, keepnote, lambda i, n: "solution" not in n, clean_function=clean_function_1a, fLOG=fLOG) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_expose1(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") temp = get_temp_folder(__file__, "temp_notebookexpose1_") keepnote = ls_notebooks("expose") assert len(keepnote) > 0 res = execute_notebooks( temp, keepnote, lambda i, n: "velib" not in n and "paris_parcours" not in n and "ml_table_mortalite" not in n, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_correction(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") if is_travis_or_appveyor() == "travis": # requires MKL return from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, unittest_raise_exception_notebook temp = get_temp_folder(__file__, "temp_notebook2a_4_correction") keepnote = ls_notebooks("td2a_ml") assert len(keepnote) > 0 res = execute_notebooks(temp, keepnote, lambda i, n: "_4" in n and "correction" in n, fLOG=fLOG, replacements=self.get_replacements()) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks from src.ensae_teaching_cs.automation.notebook_test_helper import ( unittest_raise_exception_notebook, clean_function_1a, ) temp = get_temp_folder(__file__, "temp_notebook2a_1") keepnote = ls_notebooks("competitions/2016") assert len(keepnote) > 0 res = execute_notebooks( temp, keepnote, lambda i, n: "solution" not in n, clean_function=clean_function_1a, fLOG=fLOG ) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_1a(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_1a, unittest_raise_exception_notebook from src.ensae_teaching_cs.helpers.size_helper import total_size assert total_size temp = get_temp_folder(__file__, "temp_notebook1a_") keepnote = ls_notebooks("1a") assert len(keepnote) > 0 res = execute_notebooks(temp, keepnote, lambda i, n: "deviner" not in n, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_enonce(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, unittest_raise_exception_notebook from src.ensae_teaching_cs.data import simple_database temp = get_temp_folder(__file__, "temp_notebook2a_eco_sql") keepnote = ls_notebooks("td2a_eco") shutil.copy(simple_database(), temp) assert len(keepnote) > 0 res = execute_notebooks(temp, keepnote, lambda i, n: "sql" in n, fLOG=fLOG, replacements=self.get_replacements()) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, unittest_raise_exception_notebook from src.ensae_teaching_cs.data import simple_database temp = get_temp_folder(__file__, "temp_notebook2a_2_corection") keepnote = ls_notebooks("td2a") assert len(keepnote) > 0 shutil.copy(simple_database(), temp) res = execute_notebooks( temp, keepnote, lambda i, n: "_2" in n and "correction" in n and "_2B" not in n, fLOG=fLOG) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_exposelong2(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_1a, unittest_raise_exception_notebook temp = get_temp_folder(__file__, "temp_notebookexposelong2_") keepnote = ls_notebooks("expose") assert len(keepnote) > 0 res = execute_notebooks( temp, keepnote, lambda i, n: "paris_parcours" in n, fLOG=fLOG, deepfLOG=fLOG if __name__ == "__main__" else noLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_correction_8(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_1a from src.ensae_teaching_cs.automation.notebook_test_helper import unittest_raise_exception_notebook temp = get_temp_folder(__file__, "temp_notebook1a_correction_8") keepnote = ls_notebooks("td1a") assert len(keepnote) > 0 clog = CustomLog(temp) res = execute_notebooks(temp, keepnote, lambda i, n: "correction_session8." in n, fLOG=clog, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_1a(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_1a, unittest_raise_exception_notebook from src.ensae_teaching_cs.helpers.size_helper import total_size assert total_size temp = get_temp_folder(__file__, "temp_notebook1a_") keepnote = ls_notebooks("1a") assert len(keepnote) > 0 res = execute_notebooks(temp, keepnote, lambda i, n: "deviner" not in n, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_enonce_12(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") if is_travis_or_appveyor() == "travis": # issue with MKL on travis return temp = get_temp_folder(__file__, "temp_notebook1a_enonce_12") keepnote = ls_notebooks("td1a") assert len(keepnote) > 0 res = execute_notebooks(temp, keepnote, lambda i, n: "cenonce_session_12" in n, fLOG=fLOG, deepfLOG=fLOG if __name__ == "__main__" else noLOG, clean_function=TestNotebookRunner1a_enonce_12.clean_function) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_correction(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") if is_travis_or_appveyor() == "travis": # requires MKL return from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, unittest_raise_exception_notebook temp = get_temp_folder(__file__, "temp_notebook2a_4_correction") keepnote = ls_notebooks("td2a_ml") assert len(keepnote) > 0 res = execute_notebooks(temp, keepnote, lambda i, n: "_4" in n and "correction" in n, fLOG=fLOG, replacements=self.get_replacements()) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_enonce_9(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") if is_travis_or_appveyor() == "travis": # requires MKL and this is not yet a good story return temp = get_temp_folder(__file__, "temp_notebook1a_enonce_9") from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_1a, unittest_raise_exception_notebook keepnote = ls_notebooks("td1a") assert len(keepnote) > 0 res = execute_notebooks(temp, keepnote, lambda i, n: "cenonce_session9." in n, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_enonce_9(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") if is_travis_or_appveyor() == "travis": # requires MKL and this is not yet a good story return temp = get_temp_folder(__file__, "temp_notebook1a_enonce_9") from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_1a, unittest_raise_exception_notebook keepnote = ls_notebooks("td1a") assert len(keepnote) > 0 res = execute_notebooks(temp, keepnote, lambda i, n: "cenonce_session9." in n, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_correction_10(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_1a, unittest_raise_exception_notebook temp = get_temp_folder(__file__, "temp_notebook1a_correction_10") keepnote = ls_notebooks("td1a") assert len(keepnote) > 0 if is_travis_or_appveyor() == "travis": warnings.warn("too long") return res = execute_notebooks(temp, keepnote, lambda i, n: "_12" not in n and "session_10." in n and "correction" in n, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_1a, unittest_raise_exception_notebook temp = get_temp_folder(__file__, "temp_notebook2a_2_enonce_2B") # The folder must remain, I did not find a way to install # a package without a message box. os.environ["R_USER"] = "******" keepnote = ls_notebooks("td2a") assert len(keepnote) > 0 res = execute_notebooks(temp, keepnote, lambda i, n: "_2" in n and "enonce" in n and "_2B" in n, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_enonce_1_7(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") temp = get_temp_folder(__file__, "temp_notebook1a_enonce_1_7") keepnote = ls_notebooks("td1a") assert len(keepnote) > 0 res = execute_notebooks( temp, keepnote, lambda i, n: "_12" not in n and "cenonce_session1." not in n and "cenonce_session6." not in n and "cenonce_session8." not in n and "cenonce_session9." not in n and "cenonce_session_10." not in n and "cenonce_session_11." not in n and "enonce" in n, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_enonce_12(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, unittest_raise_exception_notebook if is_travis_or_appveyor() == "travis": # issue with MKL on travis return temp = get_temp_folder(__file__, "temp_notebook1a_correction_12") keepnote = ls_notebooks("td1a") assert len(keepnote) > 0 res = execute_notebooks(temp, keepnote, lambda i, n: "correction_session_12" in n, fLOG=fLOG, deepfLOG=fLOG if __name__ == "__main__" else noLOG, clean_function=TestNotebookRunner1a_correction_12.clean_function) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_enonce(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, unittest_raise_exception_notebook from src.ensae_teaching_cs.data import simple_database temp = get_temp_folder(__file__, "temp_notebook2a_eco_sql") keepnote = ls_notebooks("td2a_eco") shutil.copy(simple_database(), temp) assert len(keepnote) > 0 res = execute_notebooks( temp, keepnote, lambda i, n: "sql" in n, fLOG=fLOG, replacements=self.get_replacements()) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_1a, unittest_raise_exception_notebook temp = get_temp_folder(__file__, "temp_notebook2a_2_enonce_2B") # The folder must remain, I did not find a way to install # a package without a message box. os.environ["R_USER"] = "******" keepnote = ls_notebooks("td2a") assert len(keepnote) > 0 res = execute_notebooks( temp, keepnote, lambda i, n: "_2" in n and "enonce" in n and "_2B" in n, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_correction_10(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_1a, unittest_raise_exception_notebook temp = get_temp_folder(__file__, "temp_notebook1a_correction_10") keepnote = ls_notebooks("td1a") assert len(keepnote) > 0 if is_travis_or_appveyor() == "travis": warnings.warn("too long") return res = execute_notebooks(temp, keepnote, lambda i, n: "_12" not in n and "session_10." in n and "correction" in n, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks from src.ensae_teaching_cs.automation.notebook_test_helper import unittest_raise_exception_notebook, clean_function_1a temp = get_temp_folder(__file__, "temp_notebook2a_1_tiny") keepnote = ls_notebooks("td2a_eco") assert len(keepnote) > 0 for k in keepnote: if "_1" in k: fLOG("*********", k) res = execute_notebooks( temp, keepnote, lambda i, n: "_1" in n and "td2_eco_rappels_1a" in n, clean_function=clean_function_1a, fLOG=fLOG) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks from src.ensae_teaching_cs.automation.notebook_test_helper import unittest_raise_exception_notebook, clean_function_1a temp = get_temp_folder(__file__, "temp_notebook2a_1_tiny") keepnote = ls_notebooks("td2a_eco") assert len(keepnote) > 0 for k in keepnote: if "_1" in k: fLOG("*********", k) res = execute_notebooks( temp, keepnote, lambda i, n: "_1" in n and "td2_eco_rappels_1a" in n, clean_function=clean_function_1a, fLOG=fLOG) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_1a, unittest_raise_exception_notebook temp = get_temp_folder(__file__, "temp_notebook2a_2_enonce") keepnote = ls_notebooks("td2a") assert len(keepnote) > 0 if is_travis_or_appveyor(): warnings.warn( "travis or appveyor, unable to test TestNotebookRunner2a_2_enonce.test_notebook_runner") return res = execute_notebooks(temp, keepnote, lambda i, n: "_2" in n and "enonce" in n and "_2D" not in n and "_2B" not in n, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_enonce_1_7(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") temp = get_temp_folder(__file__, "temp_notebook1a_enonce_1_7") keepnote = ls_notebooks("td1a") assert len(keepnote) > 0 res = execute_notebooks(temp, keepnote, lambda i, n: "_12" not in n and "cenonce_session1." not in n and "cenonce_session6." not in n and "cenonce_session8." not in n and "cenonce_session9." not in n and "cenonce_session_10." not in n and "cenonce_session_11." not in n and "enonce" in n, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_2a_ml(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") if is_travis_or_appveyor() == "appveyor": # too long for appveyor return from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_1a, unittest_raise_exception_notebook from src.ensae_teaching_cs.data import simple_database temp = get_temp_folder(__file__, "temp_notebook2a_eco") keepnote = ls_notebooks("td2a_ml") assert len(keepnote) > 0 shutil.copy(simple_database(), temp) def filter(i, n): if "SNCF" in n: return False if "Scraping" in n: return False if "deep_python" in n: return False if "h2o" in n: # h2o is not working from a virtual environment return False if "td2a" in os.path.split(n)[-1]: # already tested by others tests return False return True if is_travis_or_appveyor() == "travis": warnings.warn("execution does not stop") return res = execute_notebooks(temp, keepnote, filter, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") from src.ensae_teaching_cs.automation.notebook_test_helper import ls_notebooks, execute_notebooks, clean_function_1a, unittest_raise_exception_notebook temp = get_temp_folder(__file__, "temp_notebook2a_2_enonce") keepnote = ls_notebooks("td2a") assert len(keepnote) > 0 if is_travis_or_appveyor(): warnings.warn( "travis or appveyor, unable to test TestNotebookRunner2a_2_enonce.test_notebook_runner" ) return res = execute_notebooks(temp, keepnote, lambda i, n: "_2" in n and "enonce" in n and "_2D" not in n and "_2B" not in n, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_2a(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") temp = get_temp_folder(__file__, "temp_notebook2a_") keepnote = ls_notebooks("2a") assert len(keepnote) > 0 def filter(i, n): if "git" not in n and "python_r" not in n and "csharp" not in n: if not sys.platform.startswith("win") and "_convert" in n: return False else: return True return False res = execute_notebooks(temp, keepnote, filter, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner_correction_9_10(self): fLOG(__file__, self._testMethodName, OutputPrint=__name__ == "__main__") temp = get_temp_folder(__file__, "temp_notebook1a_correction_9_10") keepnote = ls_notebooks("td1a") assert len(keepnote) > 0 res = execute_notebooks( temp, keepnote, lambda i, n: "_12" not in n and "session1." not in n and "session2." not in n and "session3." not in n and "session4." not in n and "session5." not in n and "session6." not in n and "session7." not in n and "session8." not in n and "session_11." not in n and "correction" in n, fLOG=fLOG, clean_function=clean_function_1a, ) unittest_raise_exception_notebook(res, fLOG)
def test_notebook_runner(self): fLOG( __file__, self._testMethodName, OutputPrint=__name__ == "__main__") # this notebook describes how to distribute the work with multiple processors # it requires to start multiple clusters first (a command line) # and to stop them afterwards # it still needs to be implemented # we skip ! warnings.warn( "TODO: implement a unit test testing the distribution on multiple processors") return temp = get_temp_folder(__file__, "temp_notebook2a_2_enonce_2D") keepnote = ls_notebooks("td2a") assert len(keepnote) > 0 res = execute_notebooks(temp, keepnote, lambda i, n: "_2" in n and "enonce" in n and "_2D" in n, fLOG=fLOG, clean_function=clean_function_1a) unittest_raise_exception_notebook(res, fLOG)