Testing Tunnel Setup Workflows in gradio-app/gradio
This test suite validates Gradio’s tunneling functionality, focusing on both standard and custom tunnel setup for sharing Gradio interfaces. The tests ensure proper URL generation and connection handling for remote access capabilities.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
gradio-app/gradio
test/test_tunneling.py
import pytest
from gradio import Interface, networking
@pytest.mark.flaky
def test_setup_tunnel():
io = Interface(lambda x: x, "number", "number")
io.launch(show_error=True, prevent_thread_lock=True)
share_url = networking.setup_tunnel(
io.server_name, io.server_port, io.share_token, io.share_server_address
)
assert isinstance(share_url, str)
@pytest.mark.flaky
def test_setup_custom_tunnel():
io = Interface(lambda x: x, "number", "number")
io.launch(
show_error=True,
prevent_thread_lock=True,
share_server_address="my-gpt-wrapper.com:7000",
)
share_url = networking.setup_tunnel(
io.server_name, io.server_port, io.share_token, io.share_server_address
)
assert isinstance(share_url, str)