diff --git a/Lib/test/test_import/__init__.py b/Lib/test/test_import/__init__.py index 1d7f69d0a72d0e8..3c47be43a95b722 100644 --- a/Lib/test/test_import/__init__.py +++ b/Lib/test/test_import/__init__.py @@ -787,7 +787,7 @@ def test_dll_dependency_import(self): pydname = importlib.util.find_spec("_sqlite3").origin depname = os.path.join( os.path.dirname(pydname), - "sqlite3{}.dll".format("_d" if "_d" in pydname else "")) + "sqlite3{}.dll".format("_d" if "_d" in os.path.basename(pydname) else "")) with os_helper.temp_dir() as tmp: tmp2 = os.path.join(tmp, "DLLs")