From fd840b427b44896d06e92d15d809dd3856cfea2e Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk <21087696+oleksandr-pavlyk@users.noreply.github.com> Date: Mon, 29 Jun 2026 12:59:54 -0500 Subject: [PATCH] Harden tooling dependency import tests --- python/test/test_nvbench_tooling_deps.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/python/test/test_nvbench_tooling_deps.py b/python/test/test_nvbench_tooling_deps.py index d9fbcb1..f839ab6 100644 --- a/python/test/test_nvbench_tooling_deps.py +++ b/python/test/test_nvbench_tooling_deps.py @@ -29,10 +29,17 @@ def test_tooling_deps_imports_from_packaged_script_path(tmp_path, monkeypatch): ) monkeypatch.syspath_prepend(str(tmp_path)) - sys.modules.pop("cuda.bench.scripts.nvbench_tooling_deps", None) + for module_name in [ + "cuda", + "cuda.bench", + "cuda.bench.scripts", + "cuda.bench.scripts.nvbench_tooling_deps", + ]: + monkeypatch.delitem(sys.modules, module_name, raising=False) module = importlib.import_module("cuda.bench.scripts.nvbench_tooling_deps") + assert Path(module.__file__) == package_dir / "nvbench_tooling_deps.py" assert module.ToolingDependency("math", "math", "testing").extra == "tools"