diff --git a/tests/test_metadata.py b/tests/test_metadata.py index 515350c0..1e97c864 100644 --- a/tests/test_metadata.py +++ b/tests/test_metadata.py @@ -10,11 +10,20 @@ def get_site_package_folder(self): for f in site.getsitepackages(): if 'site-packages' in f: return f - - def get_installed_lib_version(self, lib_name:str): + + def find_lib_folder(self, lib_name:str): dirs = [f for f in os.listdir(self.get_site_package_folder()) if f.startswith(lib_name.replace('-', '_')+'-')] if len(dirs) == 1: - metadata_file = os.path.join(sys.exec_prefix, 'Lib', 'site-packages', dirs[0], 'METADATA') + for f in os.listdir(self.get_site_package_folder()): + print(f"file in dir: {f}") + return dirs[0] + return None + + def get_installed_lib_version(self, lib_name:str): + + dir_name = self.find_lib_folder(lib_name) + if dir_name: + metadata_file = os.path.join(sys.exec_prefix, 'Lib', 'site-packages', dir_name, 'METADATA') with open(metadata_file, 'r') as f: for l in f.readlines(): if l.startswith('Version: '):