11import unittest
22import os
33import yaml
4+ import logging
45from pathlib import Path
56
67from somef .parser .codemeta_parser import parse_codemeta_json_file
78from somef .process_results import Result
89from somef .utils import constants
910
11+ logging .basicConfig (level = logging .INFO )
1012TEST_ROOT = Path (__file__ ).parent
1113REPOS_DIR = TEST_ROOT / "test_data" / "repositories"
1214EXPECT_DIR = TEST_ROOT / "test_data" / "expected"
@@ -19,19 +21,23 @@ def load_expected(self, repo_name):
1921 if not yaml_path .exists ():
2022 if repo_name == "codemeta_repo" :
2123 return {}
22- self .skipTest (f"No expected YAML for repository '{ repo_name } '" )
24+ # self.skipTest(f"No expected YAML for repository '{repo_name}'")
25+ logging .warning (f"No expected YAML for repository '{ repo_name } '" )
26+ return None
2327 with open (yaml_path , "r" , encoding = "utf-8" ) as f :
2428 return yaml .safe_load (f )
2529
2630 def test_parse_multiple_codemeta_files (self ):
2731 for repo_folder in os .listdir (REPOS_DIR ):
28- print (f"################# Testing { repo_folder } #################" )
32+ logging . info (f"################# Testing { repo_folder } #################" )
2933 repo_path = REPOS_DIR / repo_folder
3034 codemeta_path = repo_path / "codemeta.json"
3135 if not codemeta_path .is_file ():
3236 continue
3337
3438 expected = self .load_expected (repo_folder )
39+ if expected is None :
40+ continue
3541 result = Result ()
3642 metadata_result = parse_codemeta_json_file (
3743 str (codemeta_path ),
@@ -42,7 +48,7 @@ def test_parse_multiple_codemeta_files(self):
4248 with self .subTest (repo = repo_folder ):
4349 # In order for us to check every test, we need every file in "expected" directory to be of .yaml,
4450 # and make sure the name is the same as the repo folder
45- print (f"################# Processing expectation of { repo_folder } #################" )
51+ logging . info (f"################# Processing expectation of { repo_folder } #################" )
4652 for cat_name , expected_val in expected .items ():
4753 cat_const = getattr (constants , cat_name )
4854 actual_list = metadata_result .results .get (cat_const , [])
0 commit comments