From 9402b66e0fdcab656061dbcb81f926da21f0accd Mon Sep 17 00:00:00 2001 From: alessandrofelder Date: Fri, 3 Nov 2023 11:04:57 +0000 Subject: [PATCH] tidy up validation script, remove weird test_git --- bg_atlasgen/test_git.py | 21 --------------------- bg_atlasgen/validate_atlases.py | 31 ++++++++++++++++--------------- 2 files changed, 16 insertions(+), 36 deletions(-) delete mode 100644 bg_atlasgen/test_git.py diff --git a/bg_atlasgen/test_git.py b/bg_atlasgen/test_git.py deleted file mode 100644 index 1488fed..0000000 --- a/bg_atlasgen/test_git.py +++ /dev/null @@ -1,21 +0,0 @@ -from pathlib import Path - -from git import Repo - -GENERATION_DICT = dict(example_mouse=[100]) - - -cwd = Path.home() / "bg_auto" -cwd.mkdir(exist_ok=True) - - -if __name__ == "__main__": - repo_path = cwd / "atlas_repo" - atlas_gen_path = Path(__file__).parent - - repo = Repo(repo_path) - - # repo.git.add(".") - # repo.git.commit('-m', 'test commit', author='luigi.petrucco@gmail.com') - repo.git.pull() - repo.git.push() diff --git a/bg_atlasgen/validate_atlases.py b/bg_atlasgen/validate_atlases.py index d6734f0..7c55337 100644 --- a/bg_atlasgen/validate_atlases.py +++ b/bg_atlasgen/validate_atlases.py @@ -95,18 +95,19 @@ def validate_atlas(atlas_name, version): ), "Atlas object validation failed" -valid_atlases = [] -invalid_atlases = [] -for atlas_name, version in get_all_atlases_lastversions().items(): - try: - validate_atlas(atlas_name, version) - valid_atlases.append(atlas_name) - except AssertionError as e: - invalid_atlases.append((atlas_name, e)) - continue - -print("Summary") -print("### Valid atlases ###") -print(valid_atlases) -print("### Invalid atlases ###") -print(invalid_atlases) +if __name__ == "__main__": + valid_atlases = [] + invalid_atlases = [] + for atlas_name, version in get_all_atlases_lastversions().items(): + try: + validate_atlas(atlas_name, version) + valid_atlases.append(atlas_name) + except AssertionError as e: + invalid_atlases.append((atlas_name, e)) + continue + + print("Summary") + print("### Valid atlases ###") + print(valid_atlases) + print("### Invalid atlases ###") + print(invalid_atlases)