gemini-code-assist[bot] commented on code in PR #19730:
URL: https://github.com/apache/tvm/pull/19730#discussion_r3393635125
##########
tests/python/nightly/test_nnapi/conftest.py:
##########
@@ -24,16 +23,13 @@
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
Review 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.
```suggestion
remote_session = tracker.request(rpc_device_key, priority=0,
session_timeout=600)
return remote_session, tracker
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]