Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failing app tests #19971

Merged
merged 7 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion requirements/app/app.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Jinja2 <3.2.0
PyYAML <=6.0.1
requests <2.32.0
rich >=12.3.0, <13.6.0
urllib3 <2.1.0
urllib3 <2.0.0
uvicorn <0.24.0
websocket-client <1.7.0
websockets <11.1.0
2 changes: 2 additions & 0 deletions tests/tests_app/cli/test_cmd_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from unittest import mock
from unittest.mock import ANY, MagicMock, Mock

import pytest
from click.testing import CliRunner
from lightning.app.cli.lightning_cli_launch import run_flow, run_flow_and_servers, run_frontend, run_server
from lightning.app.core.queues import QueuingSystem
Expand Down Expand Up @@ -189,6 +190,7 @@ def start_processes(**functions):


@_RunIf(skip_windows=True)
@pytest.mark.flaky(reruns=3)
def test_manage_server_processes_one_process_gets_killed(capfd):
functions = {"p1": run_forever_process, "p2": run_for_2_seconds_and_raise}
p = Process(target=start_processes, kwargs=functions)
Expand Down
2 changes: 1 addition & 1 deletion tests/tests_app/core/test_lightning_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ async def test_frontend_routes(path, expected_status_code):
assert response.status_code == expected_status_code


@pytest.mark.xfail(sys.platform == "linux", reason="No idea why... need to be fixed") # fixme
@pytest.mark.xfail(sys.platform == "linux", strict=False, reason="No idea why... need to be fixed") # fixme
def test_start_server_started():
"""This test ensures has_started_queue receives a signal when the REST API has started."""
api_publish_state_queue = mp.Queue()
Expand Down
1 change: 1 addition & 0 deletions tests/tests_app/core/test_lightning_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,7 @@ def run_once(self):
return res


@pytest.mark.flaky(reruns=3)
def test_lightning_app_has_updated():
app = TestLightningHasUpdatedApp(FlowPath())
MultiProcessRuntime(app, start_server=False).dispatch()
Expand Down
16 changes: 8 additions & 8 deletions tests/tests_app/utilities/test_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ def test_find_free_network_port_cloudspace(_, patch_constants):
@mock.patch("urllib3.connectionpool.HTTPConnectionPool._get_conn")
def test_http_client_retry_post(getconn_mock):
getconn_mock.return_value.getresponse.side_effect = [
mock.Mock(status=500, msg=HTTPMessage()),
mock.Mock(status=599, msg=HTTPMessage()),
mock.Mock(status=405, msg=HTTPMessage()),
mock.Mock(status=200, msg=HTTPMessage()),
mock.Mock(status=500, msg=HTTPMessage(), headers={}),
mock.Mock(status=599, msg=HTTPMessage(), headers={}),
mock.Mock(status=405, msg=HTTPMessage(), headers={}),
mock.Mock(status=200, msg=HTTPMessage(), headers={}),
]

client = HTTPClient(base_url="http://test.url")
Expand All @@ -69,10 +69,10 @@ def test_http_client_retry_post(getconn_mock):
@mock.patch("urllib3.connectionpool.HTTPConnectionPool._get_conn")
def test_http_client_retry_get(getconn_mock):
getconn_mock.return_value.getresponse.side_effect = [
mock.Mock(status=500, msg=HTTPMessage()),
mock.Mock(status=599, msg=HTTPMessage()),
mock.Mock(status=405, msg=HTTPMessage()),
mock.Mock(status=200, msg=HTTPMessage()),
mock.Mock(status=500, msg=HTTPMessage(), headers={}),
mock.Mock(status=599, msg=HTTPMessage(), headers={}),
mock.Mock(status=405, msg=HTTPMessage(), headers={}),
mock.Mock(status=200, msg=HTTPMessage(), headers={}),
]

client = HTTPClient(base_url="http://test.url")
Expand Down
Loading