2022-06-30 20:45:15 +00:00
|
|
|
import os
|
|
|
|
|
|
|
|
import pytest
|
2022-08-10 09:48:06 +00:00
|
|
|
from click.testing import CliRunner
|
2023-02-01 11:07:00 +00:00
|
|
|
from lightning.app.cli.lightning_cli import show
|
|
|
|
from lightning.app.testing.testing import run_app_in_cloud, wait_for
|
2022-06-30 20:45:15 +00:00
|
|
|
|
ruff: replace isort with ruff +TPU (#17684)
* ruff: replace isort with ruff
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fixing & imports
* lines in warning test
* docs
* fix enum import
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* fixing
* import
* fix lines
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* type ClusterEnvironment
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-09-26 15:54:55 +00:00
|
|
|
from integrations_app.public import _PATH_EXAMPLES
|
|
|
|
|
2022-06-30 20:45:15 +00:00
|
|
|
|
2023-05-04 15:50:39 +00:00
|
|
|
@pytest.mark.cloud()
|
2022-06-30 20:45:15 +00:00
|
|
|
def test_boring_app_example_cloud() -> None:
|
2023-03-14 18:48:17 +00:00
|
|
|
with run_app_in_cloud(os.path.join(_PATH_EXAMPLES, "boring"), app_name="app_dynamic.py", debug=True) as (
|
2022-06-30 20:45:15 +00:00
|
|
|
_,
|
|
|
|
view_page,
|
2022-10-25 13:24:20 +00:00
|
|
|
_,
|
2022-08-10 09:48:06 +00:00
|
|
|
name,
|
2022-06-30 20:45:15 +00:00
|
|
|
):
|
|
|
|
|
|
|
|
def check_hello_there(*_, **__):
|
|
|
|
locator = view_page.frame_locator("iframe").locator('ul:has-text("Hello there!")')
|
|
|
|
if len(locator.all_text_contents()):
|
|
|
|
return True
|
2023-05-05 09:34:40 +00:00
|
|
|
return None
|
2022-06-30 20:45:15 +00:00
|
|
|
|
|
|
|
wait_for(view_page, check_hello_there)
|
2022-08-10 09:48:06 +00:00
|
|
|
|
|
|
|
runner = CliRunner()
|
2022-10-27 09:05:48 +00:00
|
|
|
result = runner.invoke(show.commands["logs"], [name])
|
2022-08-10 09:48:06 +00:00
|
|
|
|
|
|
|
assert result.exit_code == 0
|
|
|
|
assert result.exception is None
|
2023-05-04 08:12:33 +00:00
|
|
|
# TODO: Resolve
|
2023-04-28 08:58:08 +00:00
|
|
|
# lines = result.output.splitlines()
|
|
|
|
# assert any("Received from root.dict.dst_w" in line for line in lines)
|
2022-09-13 14:50:36 +00:00
|
|
|
print("Succeeded App!")
|