[Tests][NNAPI] Skip tests cleanly when remote environment is unavailable#19730
Conversation
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.
There was a problem hiding this comment.
Code Review
This pull request refactors the remote function in tests/python/nightly/test_nnapi/conftest.py to explicitly skip tests using pytest.skip when required environment variables are missing, rather than returning None. Feedback suggests renaming the local variable remote to avoid shadowing the function name, which would improve code readability and maintainability.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| remote = tracker.request(rpc_device_key, priority=0, session_timeout=600) | ||
| return remote, tracker |
There was a problem hiding this comment.
The local variable remote shadows the function name remote(). While Python allows this, it can be confusing and makes the code harder to maintain. Renaming the local variable to remote_session or session would improve readability and avoid shadowing.
| remote = tracker.request(rpc_device_key, priority=0, session_timeout=600) | |
| return remote, tracker | |
| remote_session = tracker.request(rpc_device_key, priority=0, session_timeout=600) | |
| return remote_session, tracker |
…ble (apache#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. (cherry picked from commit f0ed799)
…ble (apache#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. (cherry picked from commit f0ed799)
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 withTypeError: 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.