Skip to content

[Tests][NNAPI] Skip tests cleanly when remote environment is unavailable#19730

Merged
tqchen merged 1 commit into
apache:mainfrom
tlopex:fix-nnapi-remote-skip
Jun 11, 2026
Merged

[Tests][NNAPI] Skip tests cleanly when remote environment is unavailable#19730
tqchen merged 1 commit into
apache:mainfrom
tlopex:fix-nnapi-remote-skip

Conversation

@tlopex

@tlopex tlopex commented Jun 11, 2026

Copy link
Copy Markdown
Member

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.

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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +34 to +35
remote = tracker.request(rpc_device_key, priority=0, session_timeout=600)
return remote, tracker

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
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

@tqchen tqchen merged commit f0ed799 into apache:main Jun 11, 2026
9 checks passed
MasterJH5574 pushed a commit to MasterJH5574/tvm that referenced this pull request Jun 15, 2026
…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)
MasterJH5574 pushed a commit to MasterJH5574/tvm that referenced this pull request Jun 15, 2026
…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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants