Unverified Commit c962c2ad authored by Jonas Kuball's avatar Jonas Kuball Committed by GitHub
Browse files

Adds missing module_specs for usages of _LazyModule (#15230)

* Add missing __spec__ for transformers.models.auto

* Moves the __spec__-test to the UnitTest class

* Adds module_spec to all instances of _LazyModule

* Refactors an old test from pytest to unittest
parent 6c7b68d4
......@@ -64,9 +64,11 @@ def context_fr():
print("Au revoir!")
def test_module_spec():
assert transformers.__spec__ is not None
assert importlib.util.find_spec("transformers") is not None
class TestImportMechanisms(unittest.TestCase):
def test_module_spec_available(self):
# If the spec is missing, importlib would not be able to import the module dynamically.
assert transformers.__spec__ is not None
assert importlib.util.find_spec("transformers") is not None
class GetFromCacheTests(unittest.TestCase):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment