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 f0ed799090 [Tests][NNAPI] Skip tests cleanly when remote environment 
is unavailable (#19730)
f0ed799090 is described below

commit f0ed7990900acf353b50eea1f813d38993d668b2
Author: Shushi Hong <[email protected]>
AuthorDate: Thu Jun 11 07:17:31 2026 -0400

    [Tests][NNAPI] Skip tests cleanly when remote environment is unavailable 
(#19730)
    
    The remote() helper in tests/python/nightly/test_nnapi/conftest.py
    returned None when TVM_TRACKER_HOST, TVM_TRACKER_PORT, or RPC_DEVICE_KEY
    was not set, causing every caller doing `remote_obj, tracker = remote()`
    to fail with
    `TypeError: cannot unpack non-iterable NoneType object`.
    
    Call pytest.skip() with the list of missing environment variables
    instead, so the 30 tests in test_ops.py (and test_network.py) report as
    skipped rather than failed when no NNAPI remote device is configured.
    Behavior with a configured remote is unchanged.
---
 tests/python/nightly/test_nnapi/conftest.py | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/tests/python/nightly/test_nnapi/conftest.py 
b/tests/python/nightly/test_nnapi/conftest.py
index 9c83c67c9f..385c50232f 100644
--- a/tests/python/nightly/test_nnapi/conftest.py
+++ b/tests/python/nightly/test_nnapi/conftest.py
@@ -14,7 +14,6 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-# ruff: noqa: F401
 
 import os
 
@@ -24,16 +23,13 @@ from tvm import rpc
 
 
 def remote():
-    if (
-        "TVM_TRACKER_HOST" in os.environ
-        and "TVM_TRACKER_PORT" in os.environ
-        and "RPC_DEVICE_KEY" in os.environ
-    ):
-        rpc_tracker_host = os.environ["TVM_TRACKER_HOST"]
-        rpc_tracker_port = int(os.environ["TVM_TRACKER_PORT"])
-        rpc_device_key = os.environ["RPC_DEVICE_KEY"]
-        tracker = rpc.connect_tracker(rpc_tracker_host, rpc_tracker_port)
-        remote = tracker.request(rpc_device_key, priority=0, 
session_timeout=600)
-        return remote, tracker
-    else:
-        return None
+    required_env = ("TVM_TRACKER_HOST", "TVM_TRACKER_PORT", "RPC_DEVICE_KEY")
+    missing = [name for name in required_env if name not in os.environ]
+    if missing:
+        pytest.skip(f"NNAPI remote environment unavailable: {', 
'.join(missing)} not set")
+    rpc_tracker_host = os.environ["TVM_TRACKER_HOST"]
+    rpc_tracker_port = int(os.environ["TVM_TRACKER_PORT"])
+    rpc_device_key = os.environ["RPC_DEVICE_KEY"]
+    tracker = rpc.connect_tracker(rpc_tracker_host, rpc_tracker_port)
+    remote = tracker.request(rpc_device_key, priority=0, session_timeout=600)
+    return remote, tracker

Reply via email to