def test_check_repo_size(repo_20_filled_samples): from hangar.utils import parse_bytes, folder_size expected_nbytes = folder_size(repo_20_filled_samples._repo_path, recurse=True) nbytes = repo_20_filled_samples.size_nbytes assert expected_nbytes == nbytes format_nbytes = repo_20_filled_samples.size_human # account for rounding when converting int to str. assert nbytes * 0.95 <= parse_bytes(format_nbytes) <= nbytes * 1.05
def size(self): return folder_size(self.repo._env.repo_path, recurse=True)