From 7d0d073261e2ebfffe342427918728da3ca1b4fa Mon Sep 17 00:00:00 2001 From: Sayak Paul Date: Fri, 28 Jul 2023 00:08:15 +0530 Subject: [PATCH] [Tests] add test for pipeline import. (#4276) * add test for pipeline import. * Update tests/others/test_dependencies.py Co-authored-by: Patrick von Platen * address suggestions --------- Co-authored-by: Patrick von Platen --- tests/others/test_dependencies.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/others/test_dependencies.py b/tests/others/test_dependencies.py index 3436cf92d8..3bac611e3f 100644 --- a/tests/others/test_dependencies.py +++ b/tests/others/test_dependencies.py @@ -14,6 +14,7 @@ import inspect import unittest +from importlib import import_module class DependencyTester(unittest.TestCase): @@ -37,3 +38,13 @@ class DependencyTester(unittest.TestCase): elif backend == "invisible_watermark": backend = "invisible-watermark" assert backend in deps, f"{backend} is not in the deps table!" + + def test_pipeline_imports(self): + import diffusers + import diffusers.pipelines + + all_classes = inspect.getmembers(diffusers, inspect.isclass) + for cls_name, cls_module in all_classes: + if hasattr(diffusers.pipelines, cls_name): + pipeline_folder_module = ".".join(str(cls_module.__module__).split(".")[:3]) + _ = import_module(pipeline_folder_module, str(cls_name))