File tree Expand file tree Collapse file tree 2 files changed +3
-5
lines changed Expand file tree Collapse file tree 2 files changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -267,13 +267,13 @@ def _check_requirement(require: str) -> bool:
267267 True if the installed version of the dependency matches
268268 the specified version, False otherwise.
269269 """
270- import importlib .metadata as importlib_metadata
270+ import importlib .metadata
271271
272272 import packaging .requirements
273273
274274 req = packaging .requirements .Requirement (require )
275275 return req .specifier .contains (
276- importlib_metadata .version (req .name ),
276+ importlib . metadata .version (req .name ),
277277 prereleases = True ,
278278 )
279279
Original file line number Diff line number Diff line change @@ -160,10 +160,8 @@ def test_stub_loading_errors(tmp_path):
160160
161161
162162def test_require_kwarg ():
163- have_importlib_metadata = importlib .util .find_spec ("importlib.metadata" ) is not None
164- dot = "." if have_importlib_metadata else "_"
165163 # Test with a module that definitely exists, behavior hinges on requirement
166- with mock .patch (f "importlib{ dot } metadata.version" ) as version :
164+ with mock .patch ("importlib. metadata.version" ) as version :
167165 version .return_value = "1.0.0"
168166 math = lazy .load ("math" , require = "somepkg >= 2.0" )
169167 assert isinstance (math , lazy .DelayedImportErrorModule )
You can’t perform that action at this time.
0 commit comments