adf0d17497
publish / version_or_publish (push) Waiting to run
storybook-build / changes (push) Waiting to run
storybook-build / :storybook-build (push) Blocked by required conditions
Sync Gradio Skills to Hugging Face / sync-skills (push) Waiting to run
functional / changes (push) Waiting to run
functional / build-frontend (push) Blocked by required conditions
functional / functional-test-SSR=false (push) Blocked by required conditions
functional / functional-reload (push) Blocked by required conditions
functional / functional-test-SSR=true (push) Blocked by required conditions
hygiene / hygiene-test (push) Waiting to run
python / changes (push) Waiting to run
python / build (push) Blocked by required conditions
python / test-ubuntu-latest-flaky (push) Blocked by required conditions
python / test-ubuntu-latest-not-flaky (push) Blocked by required conditions
python / test-windows-latest-flaky (push) Blocked by required conditions
python / test-windows-latest-not-flaky (push) Blocked by required conditions
js / changes (push) Waiting to run
js / js-test (push) Blocked by required conditions
docs-build / changes (push) Waiting to run
docs-build / docs-build (push) Blocked by required conditions
docs-build / website-build (push) Blocked by required conditions
31 lines
966 B
Python
31 lines
966 B
Python
import urllib.parse
|
|
|
|
import pytest
|
|
|
|
import gradio as gr
|
|
from gradio import http_server, routes
|
|
|
|
|
|
class TestStartServer:
|
|
# Test IPv4 and IPv6 hostnames as they would be passed from --server-name.
|
|
@pytest.mark.parametrize("host", ["127.0.0.1", "[::1]"])
|
|
def test_start_server(self, host):
|
|
io = gr.Interface(lambda x: x, "number", "number")
|
|
io.favicon_path = None
|
|
io.config = io.get_config_file()
|
|
io.show_error = True
|
|
io.flagging_callback.setup([gr.Number()], io.flagging_dir)
|
|
io.auth = None
|
|
app = routes.App.create_app(io)
|
|
|
|
_, _, local_path, server = http_server.start_server(app)
|
|
url = urllib.parse.urlparse(local_path)
|
|
assert url.scheme == "http"
|
|
assert url.port is not None
|
|
assert (
|
|
http_server.INITIAL_PORT_VALUE
|
|
<= url.port
|
|
<= http_server.INITIAL_PORT_VALUE + http_server.TRY_NUM_PORTS
|
|
)
|
|
server.close()
|