Add missing module __spec__ (#13321)
* added missing __spec__ to _LazyModule * test __spec__ is not None after module import * changed module_spec arg to be optional in _LazyModule * fix style issue * added module spec test to test_file_utils
This commit is contained in:
@@ -12,9 +12,11 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import importlib
|
||||
import unittest
|
||||
|
||||
import requests
|
||||
import transformers
|
||||
|
||||
# Try to import everything from transformers to ensure every object can be loaded.
|
||||
from transformers import * # noqa F406
|
||||
@@ -38,6 +40,11 @@ PINNED_SHA256 = "4b243c475af8d0a7754e87d7d096c92e5199ec2fe168a2ee7998e3b8e9bcb1d
|
||||
# Sha-256 of pytorch_model.bin on the top of `main`, for checking purposes
|
||||
|
||||
|
||||
def test_module_spec():
|
||||
assert transformers.__spec__ is not None
|
||||
assert importlib.util.find_spec("transformers") is not None
|
||||
|
||||
|
||||
class GetFromCacheTests(unittest.TestCase):
|
||||
def test_bogus_url(self):
|
||||
# This lets us simulate no connection
|
||||
|
||||
Reference in New Issue
Block a user