Skip to content

Commit 7d0d073

Browse files
[Tests] add test for pipeline import. (huggingface#4276)
* add test for pipeline import. * Update tests/others/test_dependencies.py Co-authored-by: Patrick von Platen <[email protected]> * address suggestions --------- Co-authored-by: Patrick von Platen <[email protected]>
1 parent 01b6ec2 commit 7d0d073

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/others/test_dependencies.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import inspect
1616
import unittest
17+
from importlib import import_module
1718

1819

1920
class DependencyTester(unittest.TestCase):
@@ -37,3 +38,13 @@ def test_backend_registration(self):
3738
elif backend == "invisible_watermark":
3839
backend = "invisible-watermark"
3940
assert backend in deps, f"{backend} is not in the deps table!"
41+
42+
def test_pipeline_imports(self):
43+
import diffusers
44+
import diffusers.pipelines
45+
46+
all_classes = inspect.getmembers(diffusers, inspect.isclass)
47+
for cls_name, cls_module in all_classes:
48+
if hasattr(diffusers.pipelines, cls_name):
49+
pipeline_folder_module = ".".join(str(cls_module.__module__).split(".")[:3])
50+
_ = import_module(pipeline_folder_module, str(cls_name))

0 commit comments

Comments
 (0)