def get_model_classes(test_file):
    """Get all model classes that appear in `all_model_classes` attributes in a model test file."""
    test_classes = get_test_classes(test_file)
    model_classes = set()
    for test_class in test_classes:
        model_classes.update(test_class.all_model_classes)

    # sort with class names
    return sorted(model_classes, key=lambda x: x.__name__)
Get all model classes that appear in `all_model_classes` attributes in a model test file.
dpkd/transformers/utils/get_test_info.py