Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 10 additions & 14 deletions tests/python/nightly/test_nnapi/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Comment on lines +34 to +35

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

Loading