This is an automated email from the ASF dual-hosted git repository.
tqchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new 385b7d9f92 [TEST][Relax] Fix PyModule registry cleanup test after
parser refactor (#20432)
385b7d9f92 is described below
commit 385b7d9f92b2d22a9afc0fa2f304b2c5f4aa3161
Author: Shushi Hong <[email protected]>
AuthorDate: Thu Sep 24 16:32:23 2026 -0400
[TEST][Relax] Fix PyModule registry cleanup test after parser refactor
(#20432)
After #20423 renamed the Python-function metadata to `__pyfuncs__`, the
cleanup test added in #20417 still populated `pyfuncs`. Registration
therefore returned early, allowing the test to pass without exercising
cleanup.
This pr updates the fixture to use `__pyfuncs__` and assert that the
function is registered before deleting the module. This ensures the test
verifies that destruction removes the module’s own registration while
preserving unrelated entries.
---
tests/python/relax/test_relax_operators.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/python/relax/test_relax_operators.py
b/tests/python/relax/test_relax_operators.py
index 639ccbe67a..865acd4546 100644
--- a/tests/python/relax/test_relax_operators.py
+++ b/tests/python/relax/test_relax_operators.py
@@ -495,8 +495,9 @@ def test_py_func_registry_is_scoped_to_its_module():
# __new__ skips __init__'s JIT compilation; only the registration matters
here.
module = BasePyModule.__new__(BasePyModule)
- module.ir_mod = SimpleNamespace(pyfuncs={"registry_owned": lambda self, x:
x})
+ module.ir_mod = SimpleNamespace(__pyfuncs__={"registry_owned": lambda
self, x: x})
module._register_python_functions()
+ assert get_func("registry_owned") is not None
module_ref = weakref.ref(module)
del module