Skip to content

Commit

Permalink
[Tests] add test for pipeline import. (huggingface#4276)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
sayakpaul and patrickvonplaten authored Jul 27, 2023
1 parent 01b6ec2 commit 7d0d073
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/others/test_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import inspect
import unittest
from importlib import import_module


class DependencyTester(unittest.TestCase):
Expand All @@ -37,3 +38,13 @@ def test_backend_registration(self):
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))

0 comments on commit 7d0d073

Please sign in to comment.