def test_create_old_overview_report(self): # fixme: # The tested method is deprecated and should be replaced by templates as soon as possible. # we create a target directory populated with only a few files and create a overview html from it d = defaults() #sp=d['paths']['tested_records'] sp = d['paths']['tested_records'].parent.joinpath('VerosTestModels') src_dir_name = 'localDataBase' src_dir_path = Path(src_dir_name) src_dir_path.mkdir() rec_list = [rec for rec in sp.glob('*.yaml')] #[0:2] for rec in rec_list: src = str(sp.joinpath(rec)) target = (src_dir_name) shutil.copy(src, src_dir_name) ml = ModelList.from_dir_path(src_dir_path) target_dir_path = Path('.').joinpath('html') targetFileName = 'overview.html' create_overview_report(ml, target_dir_path, targetFileName) targetPath = target_dir_path.joinpath(targetFileName) self.assertTrue(targetPath.exists())
def table(request): from bgc_md.ModelList import ModelList from bgc_md.reports import defaults d=defaults() source_dir_path=d['paths']['tested_records'] ml=ModelList.from_dir_path(src_dir_path) target_dir_path=Path('.').joinpath('html') targetFileName='table.html' rel=ml.create_overview_table(target_dir_path,targetFileName) return HttpResponse('Test')
def test_website_from_template(self): d = defaults() sp = d['paths']['tested_records'].parent.joinpath('TestModels_1') model_list = ModelList.from_dir_path(sp) list_tp = d['paths']['report_templates'].joinpath( 'multiple_model', 'Website.py') #rel=render(list_tp,model_list=model_list) rel = render(list_tp, model_list) target_dir_path = Path('.') target_dir_path.mkdir(parents=True, exist_ok=True) targetFileName = 'overview.html' rel.write_pandoc_html(target_dir_path.joinpath(targetFileName))
def test_create_overview_table(self): # we create a target directory populated with only a few files and create a overview html from it d = defaults() sp = d['paths']['tested_records'] src_dir_name = 'localDataBase' src_dir_path = Path(src_dir_name) src_dir_path.mkdir() rec_list = [rec for rec in sp.glob('*.yaml')][0:1] for rec in rec_list: print(rec) src = (sp.joinpath(rec)).as_posix() target = (src_dir_name) shutil.copy(src, src_dir_name) ml = ModelList.from_dir_path(src_dir_path) target_dir_path = Path('.').joinpath('html') rel = ml.create_overview_table(target_dir_path) targetFileName = 'table.html' targetPath = target_dir_path.joinpath(targetFileName) rel.write_pandoc_html(targetPath) print(targetPath) self.assertTrue(targetPath.exists())
def setUp(self): this = Path(__file__).parents[1] #the package dir vegModelPath = defaults()['paths'][ 'veg'] ### Fix me!!! Temporarily changed Vegetation for Test self.ml = ModelList.from_dir_path(vegModelPath)