MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / find_tested_models

Function find_tested_models

diffusers/utils/check_repo.py:354–369  ·  view source on GitHub ↗

Parse the content of test_file to detect what's in all_model_classes

(test_file)

Source from the content-addressed store, hash-verified

352# This is a bit hacky but I didn't find a way to import the test_file as a module and read inside the tester class
353# for the all_model_classes variable.
354def find_tested_models(test_file):
355 """Parse the content of test_file to detect what's in all_model_classes"""
356 # This is a bit hacky but I didn't find a way to import the test_file as a module and read inside the class
357 with open(os.path.join(PATH_TO_TESTS, test_file), "r", encoding="utf-8", newline="\n") as f:
358 content = f.read()
359 all_models = re.findall(r"all_model_classes\s+=\s+\(\s*\(([^\)]*)\)", content)
360 # Check with one less parenthesis as well
361 all_models += re.findall(r"all_model_classes\s+=\s+\(([^\)]*)\)", content)
362 if len(all_models) > 0:
363 model_tested = []
364 for entry in all_models:
365 for line in entry.split(","):
366 name = line.strip()
367 if len(name) > 0:
368 model_tested.append(name)
369 return model_tested
370
371
372def check_models_are_tested(module, test_file):

Callers 1

check_models_are_testedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected