From a89e5559c98fa544612196d37c824612a9d6aa74 Mon Sep 17 00:00:00 2001 From: Jirka Date: Tue, 22 Nov 2022 15:53:32 +0100 Subject: [PATCH 01/12] rename _examples dir --- .azure/app-cloud-e2e.yml | 8 ++++---- .github/CODEOWNERS | 2 +- .github/checkgroup.yml | 4 ++-- .github/labeler.yml | 12 ++++++------ .github/workflows/ci-app-examples.yml | 4 ++-- .../__init__.py | 0 .../collect_failures/__init__.py | 0 .../collect_failures/app.py | 0 .../collect_failures/requirements.txt | 0 .../components/__init__.py | 0 .../components/python/__init__.py | 0 .../components/python/test_scripts.py | 0 .../conftest.py | 0 .../core_features_app/app.py | 2 +- .../custom_work_dependencies/__init__.py | 0 .../custom_work_dependencies/app.py | 0 .../idle_timeout/__init__.py | 0 .../idle_timeout/app.py | 0 .../layout.py | 0 .../pickle_or_not.py | 0 .../test_app_dag.py | 0 .../test_argparse.py | 0 .../test_boring_app.py | 0 .../test_collect_failures.py | 2 +- .../test_commands_and_api.py | 0 .../test_core_features_app.py | 2 +- .../test_custom_work_dependencies.py | 2 +- .../test_drive.py | 0 .../test_idle_timeout.py | 2 +- .../test_installation_commands_app.py | 0 .../test_multi_node.py | 0 .../test_payload.py | 0 .../test_quick_start.py | 0 .../test_template_react_ui.py | 0 .../test_template_streamlit_ui.py | 0 .../test_v0_app.py | 0 36 files changed, 20 insertions(+), 20 deletions(-) rename tests/{tests_app_examples => tests_examples_app}/__init__.py (100%) rename tests/{tests_app_examples => tests_examples_app}/collect_failures/__init__.py (100%) rename tests/{tests_app_examples => tests_examples_app}/collect_failures/app.py (100%) rename tests/{tests_app_examples => tests_examples_app}/collect_failures/requirements.txt (100%) rename tests/{tests_app_examples => tests_examples_app}/components/__init__.py (100%) rename tests/{tests_app_examples => tests_examples_app}/components/python/__init__.py (100%) rename tests/{tests_app_examples => tests_examples_app}/components/python/test_scripts.py (100%) rename tests/{tests_app_examples => tests_examples_app}/conftest.py (100%) rename tests/{tests_app_examples => tests_examples_app}/core_features_app/app.py (84%) rename tests/{tests_app_examples => tests_examples_app}/custom_work_dependencies/__init__.py (100%) rename tests/{tests_app_examples => tests_examples_app}/custom_work_dependencies/app.py (100%) rename tests/{tests_app_examples => tests_examples_app}/idle_timeout/__init__.py (100%) rename tests/{tests_app_examples => tests_examples_app}/idle_timeout/app.py (100%) rename tests/{tests_app_examples => tests_examples_app}/layout.py (100%) rename tests/{tests_app_examples => tests_examples_app}/pickle_or_not.py (100%) rename tests/{tests_app_examples => tests_examples_app}/test_app_dag.py (100%) rename tests/{tests_app_examples => tests_examples_app}/test_argparse.py (100%) rename tests/{tests_app_examples => tests_examples_app}/test_boring_app.py (100%) rename tests/{tests_app_examples => tests_examples_app}/test_collect_failures.py (96%) rename tests/{tests_app_examples => tests_examples_app}/test_commands_and_api.py (100%) rename tests/{tests_app_examples => tests_examples_app}/test_core_features_app.py (85%) rename tests/{tests_app_examples => tests_examples_app}/test_custom_work_dependencies.py (90%) rename tests/{tests_app_examples => tests_examples_app}/test_drive.py (100%) rename tests/{tests_app_examples => tests_examples_app}/test_idle_timeout.py (93%) rename tests/{tests_app_examples => tests_examples_app}/test_installation_commands_app.py (100%) rename tests/{tests_app_examples => tests_examples_app}/test_multi_node.py (100%) rename tests/{tests_app_examples => tests_examples_app}/test_payload.py (100%) rename tests/{tests_app_examples => tests_examples_app}/test_quick_start.py (100%) rename tests/{tests_app_examples => tests_examples_app}/test_template_react_ui.py (100%) rename tests/{tests_app_examples => tests_examples_app}/test_template_streamlit_ui.py (100%) rename tests/{tests_app_examples => tests_examples_app}/test_v0_app.py (100%) diff --git a/.azure/app-cloud-e2e.yml b/.azure/app-cloud-e2e.yml index 0b0372e225adb..bbcf7f4cea50c 100644 --- a/.azure/app-cloud-e2e.yml +++ b/.azure/app-cloud-e2e.yml @@ -32,7 +32,7 @@ pr: - "src/lightning_app/**" - "tests/tests_app/**" - "examples/app_*/**" # some tests_app tests call examples files - - "tests/tests_app_examples/**" + - "tests/tests_examples_app/**" - "setup.py" - ".actions/**" exclude: @@ -124,7 +124,7 @@ jobs: # - bash: | # rm -rf examples/app_template_jupyterlab || true # git clone https://github.com/Lightning-AI/LAI-lightning-template-jupyterlab-App examples/app_template_jupyterlab - # cp examples/app_template_jupyterlab/tests/test_template_jupyterlab.py tests/tests_app_examples/test_template_jupyterlab.py + # cp examples/app_template_jupyterlab/tests/test_template_jupyterlab.py tests/tests_examples_app/test_template_jupyterlab.py # condition: eq(variables['name'], 'template_jupyterlab') # displayName: 'Clone Template Jupyter Lab Repo' @@ -152,8 +152,8 @@ jobs: - bash: | mkdir -p ${VIDEO_LOCATION} ls -l examples/${TEST_APP_NAME} - ls -l tests/tests_app_examples - python -m pytest tests/tests_app_examples/test_${TEST_APP_NAME}.py::test_${TEST_APP_NAME}_example_cloud --timeout=1200 --capture=no -v --color=yes + ls -l tests/tests_examples_app + python -m pytest tests/tests_examples_app/test_${TEST_APP_NAME}.py::test_${TEST_APP_NAME}_example_cloud --timeout=1200 --capture=no -v --color=yes env: HEADLESS: '1' PACKAGE_LIGHTNING: '1' diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 980583073c486..dbf5427379494 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -45,7 +45,7 @@ # Lightning App /src/lightning_app @tchaton @lantiga @awaelchli @hhsecond @ethanwharris /tests/tests_app @tchaton @lantiga @awaelchli @hhsecond @ethanwharris -/tests/tests_app_examples @tchaton @lantiga @awaelchli @hhsecond @ethanwharris +/tests/tests_examples_app @tchaton @lantiga @awaelchli @hhsecond @ethanwharris /examples/app_* @tchaton @lantiga @awaelchli @hhsecond @ethanwharris /.github/CODEOWNERS @williamfalcon diff --git a/.github/checkgroup.yml b/.github/checkgroup.yml index 71c1d875abb60..5e8d2ff18353e 100644 --- a/.github/checkgroup.yml +++ b/.github/checkgroup.yml @@ -245,7 +245,7 @@ subprojects: paths: - ".github/workflows/ci-app-examples.yml" - "src/lightning_app/**" - - "tests/tests_app_examples/**" + - "tests/tests_examples_app/**" - "examples/app_*/**" - "requirements/app/**" - "setup.py" @@ -271,7 +271,7 @@ subprojects: - "src/lightning_app/**" - "tests/tests_app/**" - "examples/app_*/**" # some tests_app tests call examples files - - "tests/tests_app_examples/**" + - "tests/tests_examples_app/**" - "setup.py" - ".actions/**" - "!requirements/app/docs.txt" diff --git a/.github/labeler.yml b/.github/labeler.yml index 1e0122683f76c..9be04ea82888d 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -5,7 +5,7 @@ app: all: ['!src/pytorch_lightning/**/*', '!tests/tests_pytorch/**/*', '!docs/source-pytorch/**/*', '!requirements/pytorch/*'] - any: ['tests/tests_app/**/*'] all: ['!src/pytorch_lightning/**/*', '!tests/tests_pytorch/**/*', '!docs/source-pytorch/**/*', '!requirements/pytorch/*'] -- any: ['tests/tests_app_examples/**/*'] +- any: ['tests/tests_examples_app/**/*'] all: ['!src/pytorch_lightning/**/*', '!tests/tests_pytorch/**/*', '!docs/source-pytorch/**/*', '!requirements/pytorch/*'] - any: ['examples/app_*/**/*'] all: ['!src/pytorch_lightning/**/*', '!tests/tests_pytorch/**/*', '!docs/source-pytorch/**/*', '!requirements/pytorch/*'] @@ -16,12 +16,12 @@ app: pl: - any: ['src/pytorch_lightning/**/*'] - all: ['!src/lightning/**/*', '!src/lightning_app/**/*', '!tests/tests_app/**/*', '!tests/tests_app_examples/**/*', '!docs/source-app/**/*', '!requirements/app/*'] + all: ['!src/lightning/**/*', '!src/lightning_app/**/*', '!tests/tests_app/**/*', '!tests/tests_examples_app/**/*', '!docs/source-app/**/*', '!requirements/app/*'] - any: ['examples/*pl_*/**/*'] - all: ['!src/lightning/**/*', '!src/lightning_app/**/*', '!tests/tests_app/**/*', '!tests/tests_app_examples/**/*', '!docs/source-app/**/*', '!requirements/app/*'] + all: ['!src/lightning/**/*', '!src/lightning_app/**/*', '!tests/tests_app/**/*', '!tests/tests_examples_app/**/*', '!docs/source-app/**/*', '!requirements/app/*'] - any: ['tests/tests_pytorch/**/*'] - all: ['!src/lightning/**/*', '!src/lightning_app/**/*', '!tests/tests_app/**/*', '!tests/tests_app_examples/**/*', '!docs/source-app/**/*', '!requirements/app/*'] + all: ['!src/lightning/**/*', '!src/lightning_app/**/*', '!tests/tests_app/**/*', '!tests/tests_examples_app/**/*', '!docs/source-app/**/*', '!requirements/app/*'] - any: ['docs/source-pytorch/**/*'] - all: ['!src/lightning/**/*', '!src/lightning_app/**/*', '!tests/tests_app/**/*', '!tests/tests_app_examples/**/*', '!docs/source-app/**/*', '!requirements/app/*'] + all: ['!src/lightning/**/*', '!src/lightning_app/**/*', '!tests/tests_app/**/*', '!tests/tests_examples_app/**/*', '!docs/source-app/**/*', '!requirements/app/*'] - any: ['requirements/pytorch/*'] - all: ['!src/lightning/**/*', '!src/lightning_app/**/*', '!tests/tests_app/**/*', '!tests/tests_app_examples/**/*', '!docs/source-app/**/*', '!requirements/app/*'] + all: ['!src/lightning/**/*', '!src/lightning_app/**/*', '!tests/tests_app/**/*', '!tests/tests_examples_app/**/*', '!docs/source-app/**/*', '!requirements/app/*'] diff --git a/.github/workflows/ci-app-examples.yml b/.github/workflows/ci-app-examples.yml index 9646efa27db66..c9d401fa2e9fb 100644 --- a/.github/workflows/ci-app-examples.yml +++ b/.github/workflows/ci-app-examples.yml @@ -10,7 +10,7 @@ on: paths: - ".github/workflows/ci-app-examples.yml" - "src/lightning_app/**" - - "tests/tests_app_examples/**" + - "tests/tests_examples_app/**" - "examples/app_*/**" - "requirements/app/**" - "setup.py" @@ -111,7 +111,7 @@ jobs: AWS_DEFAULT_REGION: us-east-1 PYTEST_ARTIFACT: results-${{ runner.os }}-${{ matrix.python-version }}-${{ matrix.requires }}.xml run: | - coverage run --source ${COVERAGE_SCOPE} -m pytest -m "not cloud" tests_app_examples --timeout=300 -vvvv --junitxml=$PYTEST_ARTIFACT --durations=0 + coverage run --source ${COVERAGE_SCOPE} -m pytest -m "not cloud" tests_examples_app --timeout=300 -vvvv --junitxml=$PYTEST_ARTIFACT --durations=0 - name: Upload pytest test results uses: actions/upload-artifact@v3 diff --git a/tests/tests_app_examples/__init__.py b/tests/tests_examples_app/__init__.py similarity index 100% rename from tests/tests_app_examples/__init__.py rename to tests/tests_examples_app/__init__.py diff --git a/tests/tests_app_examples/collect_failures/__init__.py b/tests/tests_examples_app/collect_failures/__init__.py similarity index 100% rename from tests/tests_app_examples/collect_failures/__init__.py rename to tests/tests_examples_app/collect_failures/__init__.py diff --git a/tests/tests_app_examples/collect_failures/app.py b/tests/tests_examples_app/collect_failures/app.py similarity index 100% rename from tests/tests_app_examples/collect_failures/app.py rename to tests/tests_examples_app/collect_failures/app.py diff --git a/tests/tests_app_examples/collect_failures/requirements.txt b/tests/tests_examples_app/collect_failures/requirements.txt similarity index 100% rename from tests/tests_app_examples/collect_failures/requirements.txt rename to tests/tests_examples_app/collect_failures/requirements.txt diff --git a/tests/tests_app_examples/components/__init__.py b/tests/tests_examples_app/components/__init__.py similarity index 100% rename from tests/tests_app_examples/components/__init__.py rename to tests/tests_examples_app/components/__init__.py diff --git a/tests/tests_app_examples/components/python/__init__.py b/tests/tests_examples_app/components/python/__init__.py similarity index 100% rename from tests/tests_app_examples/components/python/__init__.py rename to tests/tests_examples_app/components/python/__init__.py diff --git a/tests/tests_app_examples/components/python/test_scripts.py b/tests/tests_examples_app/components/python/test_scripts.py similarity index 100% rename from tests/tests_app_examples/components/python/test_scripts.py rename to tests/tests_examples_app/components/python/test_scripts.py diff --git a/tests/tests_app_examples/conftest.py b/tests/tests_examples_app/conftest.py similarity index 100% rename from tests/tests_app_examples/conftest.py rename to tests/tests_examples_app/conftest.py diff --git a/tests/tests_app_examples/core_features_app/app.py b/tests/tests_examples_app/core_features_app/app.py similarity index 84% rename from tests/tests_app_examples/core_features_app/app.py rename to tests/tests_examples_app/core_features_app/app.py index 069384f721290..ae1f3a2104db0 100644 --- a/tests/tests_app_examples/core_features_app/app.py +++ b/tests/tests_examples_app/core_features_app/app.py @@ -8,7 +8,7 @@ def __init__(self): super().__init__() def run(self): - # these env vars are set here: tests/tests_app_examples/test_core_features_app.py:15 + # these env vars are set here: tests/tests_examples_app/test_core_features_app.py:15 assert os.getenv("FOO", "") == "bar" assert os.getenv("BLA", "") == "bloz" self._exit() diff --git a/tests/tests_app_examples/custom_work_dependencies/__init__.py b/tests/tests_examples_app/custom_work_dependencies/__init__.py similarity index 100% rename from tests/tests_app_examples/custom_work_dependencies/__init__.py rename to tests/tests_examples_app/custom_work_dependencies/__init__.py diff --git a/tests/tests_app_examples/custom_work_dependencies/app.py b/tests/tests_examples_app/custom_work_dependencies/app.py similarity index 100% rename from tests/tests_app_examples/custom_work_dependencies/app.py rename to tests/tests_examples_app/custom_work_dependencies/app.py diff --git a/tests/tests_app_examples/idle_timeout/__init__.py b/tests/tests_examples_app/idle_timeout/__init__.py similarity index 100% rename from tests/tests_app_examples/idle_timeout/__init__.py rename to tests/tests_examples_app/idle_timeout/__init__.py diff --git a/tests/tests_app_examples/idle_timeout/app.py b/tests/tests_examples_app/idle_timeout/app.py similarity index 100% rename from tests/tests_app_examples/idle_timeout/app.py rename to tests/tests_examples_app/idle_timeout/app.py diff --git a/tests/tests_app_examples/layout.py b/tests/tests_examples_app/layout.py similarity index 100% rename from tests/tests_app_examples/layout.py rename to tests/tests_examples_app/layout.py diff --git a/tests/tests_app_examples/pickle_or_not.py b/tests/tests_examples_app/pickle_or_not.py similarity index 100% rename from tests/tests_app_examples/pickle_or_not.py rename to tests/tests_examples_app/pickle_or_not.py diff --git a/tests/tests_app_examples/test_app_dag.py b/tests/tests_examples_app/test_app_dag.py similarity index 100% rename from tests/tests_app_examples/test_app_dag.py rename to tests/tests_examples_app/test_app_dag.py diff --git a/tests/tests_app_examples/test_argparse.py b/tests/tests_examples_app/test_argparse.py similarity index 100% rename from tests/tests_app_examples/test_argparse.py rename to tests/tests_examples_app/test_argparse.py diff --git a/tests/tests_app_examples/test_boring_app.py b/tests/tests_examples_app/test_boring_app.py similarity index 100% rename from tests/tests_app_examples/test_boring_app.py rename to tests/tests_examples_app/test_boring_app.py diff --git a/tests/tests_app_examples/test_collect_failures.py b/tests/tests_examples_app/test_collect_failures.py similarity index 96% rename from tests/tests_app_examples/test_collect_failures.py rename to tests/tests_examples_app/test_collect_failures.py index 6bda6bf4bd253..7e65111d43b37 100644 --- a/tests/tests_app_examples/test_collect_failures.py +++ b/tests/tests_examples_app/test_collect_failures.py @@ -22,7 +22,7 @@ def test_collect_failures_example_cloud() -> None: "good_value_of_i_4", "invalid_value_of_i_5", ] - with run_app_in_cloud(os.path.join(_PROJECT_ROOT, "tests/tests_app_examples/collect_failures")) as ( + with run_app_in_cloud(os.path.join(_PROJECT_ROOT, "tests/tests_examples_app/collect_failures")) as ( _, _, fetch_logs, diff --git a/tests/tests_app_examples/test_commands_and_api.py b/tests/tests_examples_app/test_commands_and_api.py similarity index 100% rename from tests/tests_app_examples/test_commands_and_api.py rename to tests/tests_examples_app/test_commands_and_api.py diff --git a/tests/tests_app_examples/test_core_features_app.py b/tests/tests_examples_app/test_core_features_app.py similarity index 85% rename from tests/tests_app_examples/test_core_features_app.py rename to tests/tests_examples_app/test_core_features_app.py index 3fd425350ad0a..d96cf772fe839 100644 --- a/tests/tests_app_examples/test_core_features_app.py +++ b/tests/tests_examples_app/test_core_features_app.py @@ -12,7 +12,7 @@ def test_core_features_app_example(): result = runner.invoke( run_app, [ - os.path.join(_PROJECT_ROOT, "tests/tests_app_examples/core_features_app/app.py"), + os.path.join(_PROJECT_ROOT, "tests/tests_examples_app/core_features_app/app.py"), "--blocking", "False", "--open-ui", diff --git a/tests/tests_app_examples/test_custom_work_dependencies.py b/tests/tests_examples_app/test_custom_work_dependencies.py similarity index 90% rename from tests/tests_app_examples/test_custom_work_dependencies.py rename to tests/tests_examples_app/test_custom_work_dependencies.py index b8971e0ef2148..3df20532017c8 100644 --- a/tests/tests_app_examples/test_custom_work_dependencies.py +++ b/tests/tests_examples_app/test_custom_work_dependencies.py @@ -11,7 +11,7 @@ def test_custom_work_dependencies_example_cloud() -> None: # if requirements not installed, the app will fail with run_app_in_cloud( - os.path.join(_PROJECT_ROOT, "tests/tests_app_examples/custom_work_dependencies/"), + os.path.join(_PROJECT_ROOT, "tests/tests_examples_app/custom_work_dependencies/"), app_name="app.py", ) as (_, _, fetch_logs, _): has_logs = False diff --git a/tests/tests_app_examples/test_drive.py b/tests/tests_examples_app/test_drive.py similarity index 100% rename from tests/tests_app_examples/test_drive.py rename to tests/tests_examples_app/test_drive.py diff --git a/tests/tests_app_examples/test_idle_timeout.py b/tests/tests_examples_app/test_idle_timeout.py similarity index 93% rename from tests/tests_app_examples/test_idle_timeout.py rename to tests/tests_examples_app/test_idle_timeout.py index f06181ce86ed3..491fa4ea01af6 100644 --- a/tests/tests_app_examples/test_idle_timeout.py +++ b/tests/tests_examples_app/test_idle_timeout.py @@ -9,7 +9,7 @@ @pytest.mark.cloud def test_idle_timeout_example_cloud() -> None: - with run_app_in_cloud(os.path.join(_PROJECT_ROOT, "tests/tests_app_examples/idle_timeout")) as ( + with run_app_in_cloud(os.path.join(_PROJECT_ROOT, "tests/tests_examples_app/idle_timeout")) as ( _, _, fetch_logs, diff --git a/tests/tests_app_examples/test_installation_commands_app.py b/tests/tests_examples_app/test_installation_commands_app.py similarity index 100% rename from tests/tests_app_examples/test_installation_commands_app.py rename to tests/tests_examples_app/test_installation_commands_app.py diff --git a/tests/tests_app_examples/test_multi_node.py b/tests/tests_examples_app/test_multi_node.py similarity index 100% rename from tests/tests_app_examples/test_multi_node.py rename to tests/tests_examples_app/test_multi_node.py diff --git a/tests/tests_app_examples/test_payload.py b/tests/tests_examples_app/test_payload.py similarity index 100% rename from tests/tests_app_examples/test_payload.py rename to tests/tests_examples_app/test_payload.py diff --git a/tests/tests_app_examples/test_quick_start.py b/tests/tests_examples_app/test_quick_start.py similarity index 100% rename from tests/tests_app_examples/test_quick_start.py rename to tests/tests_examples_app/test_quick_start.py diff --git a/tests/tests_app_examples/test_template_react_ui.py b/tests/tests_examples_app/test_template_react_ui.py similarity index 100% rename from tests/tests_app_examples/test_template_react_ui.py rename to tests/tests_examples_app/test_template_react_ui.py diff --git a/tests/tests_app_examples/test_template_streamlit_ui.py b/tests/tests_examples_app/test_template_streamlit_ui.py similarity index 100% rename from tests/tests_app_examples/test_template_streamlit_ui.py rename to tests/tests_examples_app/test_template_streamlit_ui.py diff --git a/tests/tests_app_examples/test_v0_app.py b/tests/tests_examples_app/test_v0_app.py similarity index 100% rename from tests/tests_app_examples/test_v0_app.py rename to tests/tests_examples_app/test_v0_app.py From 324b1c67616d1b60f2bb9c82c5ebbe34b7a7d4d5 Mon Sep 17 00:00:00 2001 From: Jirka Date: Tue, 22 Nov 2022 16:26:27 +0100 Subject: [PATCH 02/12] refactor --- .../tests_examples_app/{ => apps}/collect_failures/app.py | 0 .../{ => apps}/collect_failures/requirements.txt | 0 .../{ => apps}/core_features_app/app.py | 0 .../{ => apps}/custom_work_dependencies/app.py | 0 tests/tests_examples_app/{ => apps}/idle_timeout/app.py | 0 tests/tests_examples_app/collect_failures/__init__.py | 0 .../custom_work_dependencies/__init__.py | 0 tests/tests_examples_app/idle_timeout/__init__.py | 0 tests/tests_examples_app/local/__init__.py | 5 +++++ .../{ => local}/test_collect_failures.py | 4 ++-- .../{ => local}/test_core_features_app.py | 4 ++-- .../{ => local}/test_custom_work_dependencies.py | 4 ++-- tests/tests_examples_app/{ => local}/test_idle_timeout.py | 4 ++-- tests/tests_examples_app/public/__init__.py | 5 +++++ tests/tests_examples_app/{ => public}/test_app_dag.py | 4 ++-- tests/tests_examples_app/{ => public}/test_argparse.py | 5 +++-- tests/tests_examples_app/{ => public}/test_boring_app.py | 8 ++------ .../{ => public}/test_commands_and_api.py | 4 ++-- tests/tests_examples_app/{ => public}/test_drive.py | 4 ++-- .../{ => public}/test_installation_commands_app.py | 4 ++-- .../{layout.py => public/test_layout.py} | 4 ++-- tests/tests_examples_app/{ => public}/test_multi_node.py | 8 ++++---- tests/tests_examples_app/{ => public}/test_payload.py | 4 ++-- .../{pickle_or_not.py => public/test_pickle_or_not.py} | 4 ++-- tests/tests_examples_app/{ => public}/test_quick_start.py | 6 +++--- .../{ => public}/test_template_react_ui.py | 4 ++-- .../{ => public}/test_template_streamlit_ui.py | 4 ++-- tests/tests_examples_app/{ => public}/test_v0_app.py | 8 ++++---- 28 files changed, 52 insertions(+), 45 deletions(-) rename tests/tests_examples_app/{ => apps}/collect_failures/app.py (100%) rename tests/tests_examples_app/{ => apps}/collect_failures/requirements.txt (100%) rename tests/tests_examples_app/{ => apps}/core_features_app/app.py (100%) rename tests/tests_examples_app/{ => apps}/custom_work_dependencies/app.py (100%) rename tests/tests_examples_app/{ => apps}/idle_timeout/app.py (100%) delete mode 100644 tests/tests_examples_app/collect_failures/__init__.py delete mode 100644 tests/tests_examples_app/custom_work_dependencies/__init__.py delete mode 100644 tests/tests_examples_app/idle_timeout/__init__.py create mode 100644 tests/tests_examples_app/local/__init__.py rename tests/tests_examples_app/{ => local}/test_collect_failures.py (88%) rename tests/tests_examples_app/{ => local}/test_core_features_app.py (79%) rename tests/tests_examples_app/{ => local}/test_custom_work_dependencies.py (81%) rename tests/tests_examples_app/{ => local}/test_idle_timeout.py (76%) create mode 100644 tests/tests_examples_app/public/__init__.py rename tests/tests_examples_app/{ => public}/test_app_dag.py (79%) rename tests/tests_examples_app/{ => public}/test_argparse.py (93%) rename tests/tests_examples_app/{ => public}/test_boring_app.py (82%) rename tests/tests_examples_app/{ => public}/test_commands_and_api.py (92%) rename tests/tests_examples_app/{ => public}/test_drive.py (78%) rename tests/tests_examples_app/{ => public}/test_installation_commands_app.py (83%) rename tests/tests_examples_app/{layout.py => public/test_layout.py} (79%) rename tests/tests_examples_app/{ => public}/test_multi_node.py (87%) rename tests/tests_examples_app/{ => public}/test_payload.py (72%) rename tests/tests_examples_app/{pickle_or_not.py => public/test_pickle_or_not.py} (79%) rename tests/tests_examples_app/{ => public}/test_quick_start.py (90%) rename tests/tests_examples_app/{ => public}/test_template_react_ui.py (87%) rename tests/tests_examples_app/{ => public}/test_template_streamlit_ui.py (86%) rename tests/tests_examples_app/{ => public}/test_v0_app.py (90%) diff --git a/tests/tests_examples_app/collect_failures/app.py b/tests/tests_examples_app/apps/collect_failures/app.py similarity index 100% rename from tests/tests_examples_app/collect_failures/app.py rename to tests/tests_examples_app/apps/collect_failures/app.py diff --git a/tests/tests_examples_app/collect_failures/requirements.txt b/tests/tests_examples_app/apps/collect_failures/requirements.txt similarity index 100% rename from tests/tests_examples_app/collect_failures/requirements.txt rename to tests/tests_examples_app/apps/collect_failures/requirements.txt diff --git a/tests/tests_examples_app/core_features_app/app.py b/tests/tests_examples_app/apps/core_features_app/app.py similarity index 100% rename from tests/tests_examples_app/core_features_app/app.py rename to tests/tests_examples_app/apps/core_features_app/app.py diff --git a/tests/tests_examples_app/custom_work_dependencies/app.py b/tests/tests_examples_app/apps/custom_work_dependencies/app.py similarity index 100% rename from tests/tests_examples_app/custom_work_dependencies/app.py rename to tests/tests_examples_app/apps/custom_work_dependencies/app.py diff --git a/tests/tests_examples_app/idle_timeout/app.py b/tests/tests_examples_app/apps/idle_timeout/app.py similarity index 100% rename from tests/tests_examples_app/idle_timeout/app.py rename to tests/tests_examples_app/apps/idle_timeout/app.py diff --git a/tests/tests_examples_app/collect_failures/__init__.py b/tests/tests_examples_app/collect_failures/__init__.py deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/tests/tests_examples_app/custom_work_dependencies/__init__.py b/tests/tests_examples_app/custom_work_dependencies/__init__.py deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/tests/tests_examples_app/idle_timeout/__init__.py b/tests/tests_examples_app/idle_timeout/__init__.py deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/tests/tests_examples_app/local/__init__.py b/tests/tests_examples_app/local/__init__.py new file mode 100644 index 0000000000000..dbd6181f8e89a --- /dev/null +++ b/tests/tests_examples_app/local/__init__.py @@ -0,0 +1,5 @@ +import os + +from lightning_app import _PROJECT_ROOT + +_PATH_APPS = os.path.join(_PROJECT_ROOT, "tests", "tests_examples_app", "apps") diff --git a/tests/tests_examples_app/test_collect_failures.py b/tests/tests_examples_app/local/test_collect_failures.py similarity index 88% rename from tests/tests_examples_app/test_collect_failures.py rename to tests/tests_examples_app/local/test_collect_failures.py index 7e65111d43b37..3e1c003be0cda 100644 --- a/tests/tests_examples_app/test_collect_failures.py +++ b/tests/tests_examples_app/local/test_collect_failures.py @@ -2,8 +2,8 @@ from time import sleep import pytest +from tests_examples_app.local import _PATH_APPS -from lightning_app import _PROJECT_ROOT from lightning_app.testing.testing import run_app_in_cloud @@ -22,7 +22,7 @@ def test_collect_failures_example_cloud() -> None: "good_value_of_i_4", "invalid_value_of_i_5", ] - with run_app_in_cloud(os.path.join(_PROJECT_ROOT, "tests/tests_examples_app/collect_failures")) as ( + with run_app_in_cloud(os.path.join(_PATH_APPS, "collect_failures")) as ( _, _, fetch_logs, diff --git a/tests/tests_examples_app/test_core_features_app.py b/tests/tests_examples_app/local/test_core_features_app.py similarity index 79% rename from tests/tests_examples_app/test_core_features_app.py rename to tests/tests_examples_app/local/test_core_features_app.py index d96cf772fe839..d5ca57f3d8be6 100644 --- a/tests/tests_examples_app/test_core_features_app.py +++ b/tests/tests_examples_app/local/test_core_features_app.py @@ -1,7 +1,7 @@ import os from click.testing import CliRunner -from tests_app import _PROJECT_ROOT +from tests_examples_app.local import _PATH_APPS from lightning_app.cli.lightning_cli import run_app @@ -12,7 +12,7 @@ def test_core_features_app_example(): result = runner.invoke( run_app, [ - os.path.join(_PROJECT_ROOT, "tests/tests_examples_app/core_features_app/app.py"), + os.path.join(_PATH_APPS, "core_features_app", "app.py"), "--blocking", "False", "--open-ui", diff --git a/tests/tests_examples_app/test_custom_work_dependencies.py b/tests/tests_examples_app/local/test_custom_work_dependencies.py similarity index 81% rename from tests/tests_examples_app/test_custom_work_dependencies.py rename to tests/tests_examples_app/local/test_custom_work_dependencies.py index 3df20532017c8..edaaade95119f 100644 --- a/tests/tests_examples_app/test_custom_work_dependencies.py +++ b/tests/tests_examples_app/local/test_custom_work_dependencies.py @@ -2,7 +2,7 @@ from time import sleep import pytest -from tests_app import _PROJECT_ROOT +from tests_examples_app.local import _PATH_APPS from lightning_app.testing.testing import run_app_in_cloud @@ -11,7 +11,7 @@ def test_custom_work_dependencies_example_cloud() -> None: # if requirements not installed, the app will fail with run_app_in_cloud( - os.path.join(_PROJECT_ROOT, "tests/tests_examples_app/custom_work_dependencies/"), + os.path.join(_PATH_APPS, "custom_work_dependencies"), app_name="app.py", ) as (_, _, fetch_logs, _): has_logs = False diff --git a/tests/tests_examples_app/test_idle_timeout.py b/tests/tests_examples_app/local/test_idle_timeout.py similarity index 76% rename from tests/tests_examples_app/test_idle_timeout.py rename to tests/tests_examples_app/local/test_idle_timeout.py index 491fa4ea01af6..1de9e03d0bc1b 100644 --- a/tests/tests_examples_app/test_idle_timeout.py +++ b/tests/tests_examples_app/local/test_idle_timeout.py @@ -2,14 +2,14 @@ from time import sleep import pytest -from tests_app import _PROJECT_ROOT +from tests_examples_app.local import _PATH_APPS from lightning_app.testing.testing import run_app_in_cloud @pytest.mark.cloud def test_idle_timeout_example_cloud() -> None: - with run_app_in_cloud(os.path.join(_PROJECT_ROOT, "tests/tests_examples_app/idle_timeout")) as ( + with run_app_in_cloud(os.path.join(_PATH_APPS, "idle_timeout")) as ( _, _, fetch_logs, diff --git a/tests/tests_examples_app/public/__init__.py b/tests/tests_examples_app/public/__init__.py new file mode 100644 index 0000000000000..05ad6aba65275 --- /dev/null +++ b/tests/tests_examples_app/public/__init__.py @@ -0,0 +1,5 @@ +import os + +from lightning_app import _PROJECT_ROOT + +_PATH_APPS = os.path.join(_PROJECT_ROOT, "examples") diff --git a/tests/tests_examples_app/test_app_dag.py b/tests/tests_examples_app/public/test_app_dag.py similarity index 79% rename from tests/tests_examples_app/test_app_dag.py rename to tests/tests_examples_app/public/test_app_dag.py index 6d9a865a0a000..39b38e01b3143 100644 --- a/tests/tests_examples_app/test_app_dag.py +++ b/tests/tests_examples_app/public/test_app_dag.py @@ -2,14 +2,14 @@ from time import sleep import pytest -from tests_app import _PROJECT_ROOT +from tests_examples_app.public import _PATH_APPS from lightning_app.testing.testing import run_app_in_cloud @pytest.mark.cloud def test_app_dag_example_cloud() -> None: - with run_app_in_cloud(os.path.join(_PROJECT_ROOT, "examples/app_dag")) as (_, _, fetch_logs, _): + with run_app_in_cloud(os.path.join(_PATH_APPS, "app_dag")) as (_, _, fetch_logs, _): launch_log, finish_log = False, False while not (launch_log and finish_log): diff --git a/tests/tests_examples_app/test_argparse.py b/tests/tests_examples_app/public/test_argparse.py similarity index 93% rename from tests/tests_examples_app/test_argparse.py rename to tests/tests_examples_app/public/test_argparse.py index 7d34b7d0c00f3..fe3f06d6c1a66 100644 --- a/tests/tests_examples_app/test_argparse.py +++ b/tests/tests_examples_app/public/test_argparse.py @@ -1,7 +1,8 @@ import os import sys -from lightning_app import _PROJECT_ROOT +from tests_examples_app.public import _PATH_APPS + from lightning_app.testing.testing import application_testing from lightning_app.utilities.load_app import _patch_sys_argv @@ -10,7 +11,7 @@ def test_app_argparse_example(): original_argv = sys.argv command_line = [ - os.path.join(_PROJECT_ROOT, "examples/app_argparse/app.py"), + os.path.join(_PATH_APPS, "app_argparse", "app.py"), "--app_args", "--use_gpu", "--without-server", diff --git a/tests/tests_examples_app/test_boring_app.py b/tests/tests_examples_app/public/test_boring_app.py similarity index 82% rename from tests/tests_examples_app/test_boring_app.py rename to tests/tests_examples_app/public/test_boring_app.py index 42da5887741f9..3fa76937249cf 100644 --- a/tests/tests_examples_app/test_boring_app.py +++ b/tests/tests_examples_app/public/test_boring_app.py @@ -2,7 +2,7 @@ import pytest from click.testing import CliRunner -from tests_app import _PROJECT_ROOT +from tests_examples_app.public import _PATH_APPS from lightning_app.cli.lightning_cli import show from lightning_app.testing.testing import run_app_in_cloud, wait_for @@ -10,11 +10,7 @@ @pytest.mark.cloud def test_boring_app_example_cloud() -> None: - with run_app_in_cloud( - os.path.join(_PROJECT_ROOT, "examples/app_boring/"), - app_name="app_dynamic.py", - debug=True, - ) as ( + with run_app_in_cloud(os.path.join(_PATH_APPS, "app_boring"), app_name="app_dynamic.py", debug=True,) as ( _, view_page, _, diff --git a/tests/tests_examples_app/test_commands_and_api.py b/tests/tests_examples_app/public/test_commands_and_api.py similarity index 92% rename from tests/tests_examples_app/test_commands_and_api.py rename to tests/tests_examples_app/public/test_commands_and_api.py index a9c5fe0892983..b81ebdc372320 100644 --- a/tests/tests_examples_app/test_commands_and_api.py +++ b/tests/tests_examples_app/public/test_commands_and_api.py @@ -4,7 +4,7 @@ import pytest import requests -from tests_app import _PROJECT_ROOT +from tests_examples_app.public import _PATH_APPS from lightning_app.testing.testing import run_app_in_cloud @@ -12,7 +12,7 @@ @pytest.mark.timeout(300) @pytest.mark.cloud def test_commands_and_api_example_cloud() -> None: - with run_app_in_cloud(os.path.join(_PROJECT_ROOT, "examples/app_commands_and_api")) as ( + with run_app_in_cloud(os.path.join(_PATH_APPS, "app_commands_and_api")) as ( admin_page, view_page, fetch_logs, diff --git a/tests/tests_examples_app/test_drive.py b/tests/tests_examples_app/public/test_drive.py similarity index 78% rename from tests/tests_examples_app/test_drive.py rename to tests/tests_examples_app/public/test_drive.py index 630e76b550e9e..b9d6426c6f1a2 100644 --- a/tests/tests_examples_app/test_drive.py +++ b/tests/tests_examples_app/public/test_drive.py @@ -2,14 +2,14 @@ from time import sleep import pytest -from tests_app import _PROJECT_ROOT +from tests_examples_app.public import _PATH_APPS from lightning_app.testing.testing import run_app_in_cloud @pytest.mark.cloud def test_drive_example_cloud() -> None: - with run_app_in_cloud(os.path.join(_PROJECT_ROOT, "examples/app_drive")) as ( + with run_app_in_cloud(os.path.join(_PATH_APPS, "app_drive")) as ( _, _, fetch_logs, diff --git a/tests/tests_examples_app/test_installation_commands_app.py b/tests/tests_examples_app/public/test_installation_commands_app.py similarity index 83% rename from tests/tests_examples_app/test_installation_commands_app.py rename to tests/tests_examples_app/public/test_installation_commands_app.py index 41ba18c06bc73..2ae2fbf5a7cd4 100644 --- a/tests/tests_examples_app/test_installation_commands_app.py +++ b/tests/tests_examples_app/public/test_installation_commands_app.py @@ -1,7 +1,7 @@ import os import pytest -from tests_app import _PROJECT_ROOT +from tests_examples_app.public import _PATH_APPS from lightning_app.testing.testing import run_app_in_cloud @@ -10,7 +10,7 @@ def test_installation_commands_app_example_cloud() -> None: # This is expected to pass, since the "setup" flag is passed with run_app_in_cloud( - os.path.join(_PROJECT_ROOT, "examples/app_installation_commands"), + os.path.join(_PATH_APPS, "app_installation_commands"), app_name="app.py", extra_args=["--setup"], debug=True, diff --git a/tests/tests_examples_app/layout.py b/tests/tests_examples_app/public/test_layout.py similarity index 79% rename from tests/tests_examples_app/layout.py rename to tests/tests_examples_app/public/test_layout.py index ce65d3d9a825b..54b768aeaa276 100644 --- a/tests/tests_examples_app/layout.py +++ b/tests/tests_examples_app/public/test_layout.py @@ -1,7 +1,7 @@ import os from click.testing import CliRunner -from tests_app import _PROJECT_ROOT +from tests_examples_app.public import _PATH_APPS from lightning_app.cli.lightning_cli import run_app @@ -12,7 +12,7 @@ def test_layout_example(): result = runner.invoke( run_app, [ - os.path.join(_PROJECT_ROOT, "examples/app_layout/app.py"), + os.path.join(_PATH_APPS, "app_layout", "app.py"), "--blocking", "False", "--open-ui", diff --git a/tests/tests_examples_app/test_multi_node.py b/tests/tests_examples_app/public/test_multi_node.py similarity index 87% rename from tests/tests_examples_app/test_multi_node.py rename to tests/tests_examples_app/public/test_multi_node.py index f6fefa5b99fa5..546146f701a8c 100644 --- a/tests/tests_examples_app/test_multi_node.py +++ b/tests/tests_examples_app/public/test_multi_node.py @@ -2,7 +2,7 @@ import sys import pytest -from tests_app import _PROJECT_ROOT +from tests_examples_app.public import _PATH_APPS from lightning_app.testing.testing import application_testing, LightningTestApp @@ -16,9 +16,9 @@ def on_before_run_once(self): return res -@pytest.mark.skipif(True, reason="flaky") +@pytest.mark.skip(reason="flaky") def test_multi_node_example(monkeypatch): - monkeypatch.chdir(os.path.join(_PROJECT_ROOT, "examples/app_multi_node")) + monkeypatch.chdir(os.path.join(_PATH_APPS, "app_multi_node")) command_line = [ "app.py", "--blocking", @@ -51,7 +51,7 @@ def on_before_run_once(self): ) @pytest.mark.skipif(sys.platform == "win32", reason="flaky") def test_multi_node_examples(app_name, monkeypatch): - monkeypatch.chdir(os.path.join(_PROJECT_ROOT, "examples/app_multi_node")) + monkeypatch.chdir(os.path.join(_PATH_APPS, "app_multi_node")) command_line = [ app_name, "--blocking", diff --git a/tests/tests_examples_app/test_payload.py b/tests/tests_examples_app/public/test_payload.py similarity index 72% rename from tests/tests_examples_app/test_payload.py rename to tests/tests_examples_app/public/test_payload.py index b40b8ca52defd..73b6c8063a687 100644 --- a/tests/tests_examples_app/test_payload.py +++ b/tests/tests_examples_app/public/test_payload.py @@ -2,14 +2,14 @@ from time import sleep import pytest -from tests_app import _PROJECT_ROOT +from tests_examples_app.public import _PATH_APPS from lightning_app.testing.testing import run_app_in_cloud @pytest.mark.cloud def test_payload_example_cloud() -> None: - with run_app_in_cloud(os.path.join(_PROJECT_ROOT, "examples/app_payload")) as (_, _, fetch_logs, _): + with run_app_in_cloud(os.path.join(_PATH_APPS, "app_payload")) as (_, _, fetch_logs, _): has_logs = False while not has_logs: diff --git a/tests/tests_examples_app/pickle_or_not.py b/tests/tests_examples_app/public/test_pickle_or_not.py similarity index 79% rename from tests/tests_examples_app/pickle_or_not.py rename to tests/tests_examples_app/public/test_pickle_or_not.py index d55f39b2db28c..c3a175309da29 100644 --- a/tests/tests_examples_app/pickle_or_not.py +++ b/tests/tests_examples_app/public/test_pickle_or_not.py @@ -1,7 +1,7 @@ import os from click.testing import CliRunner -from tests_app import _PROJECT_ROOT +from tests_examples_app.public import _PATH_APPS from lightning_app.cli.lightning_cli import run_app @@ -12,7 +12,7 @@ def test_pickle_or_not_example(): result = runner.invoke( run_app, [ - os.path.join(_PROJECT_ROOT, "examples/app_pickle_or_not/app.py"), + os.path.join(_PATH_APPS, "app_pickle_or_not", "app.py"), "--blocking", "False", "--open-ui", diff --git a/tests/tests_examples_app/test_quick_start.py b/tests/tests_examples_app/public/test_quick_start.py similarity index 90% rename from tests/tests_examples_app/test_quick_start.py rename to tests/tests_examples_app/public/test_quick_start.py index ebb8583f6bd0f..e6bf63808e7b2 100644 --- a/tests/tests_examples_app/test_quick_start.py +++ b/tests/tests_examples_app/public/test_quick_start.py @@ -4,7 +4,7 @@ import pytest from click.testing import CliRunner -from tests_app import _PROJECT_ROOT +from tests_examples_app.public import _PATH_APPS from lightning_app import LightningApp from lightning_app.cli.lightning_cli import run_app @@ -38,7 +38,7 @@ def test_quick_start_example(caplog, monkeypatch): result = runner.invoke( run_app, [ - os.path.join(_PROJECT_ROOT, "lightning-quick-start/app.py"), + os.path.join(_PATH_APPS, "lightning-quick-start", "app.py"), "--blocking", "False", "--open-ui", @@ -51,7 +51,7 @@ def test_quick_start_example(caplog, monkeypatch): @pytest.mark.cloud def test_quick_start_example_cloud() -> None: - with run_app_in_cloud(os.path.join(_PROJECT_ROOT, "examples", "lightning-quick-start/")) as (_, view_page, _, _): + with run_app_in_cloud(os.path.join(_PATH_APPS, "lightning-quick-start")) as (_, view_page, _, _): def click_gradio_demo(*_, **__): button = view_page.locator('button:has-text("Interactive demo")') diff --git a/tests/tests_examples_app/test_template_react_ui.py b/tests/tests_examples_app/public/test_template_react_ui.py similarity index 87% rename from tests/tests_examples_app/test_template_react_ui.py rename to tests/tests_examples_app/public/test_template_react_ui.py index 4b4588d2397e5..143d7a00731c9 100644 --- a/tests/tests_examples_app/test_template_react_ui.py +++ b/tests/tests_examples_app/public/test_template_react_ui.py @@ -2,7 +2,7 @@ from time import sleep import pytest -from tests_app import _PROJECT_ROOT +from tests_examples_app.public import _PATH_APPS from lightning_app.testing.testing import run_app_in_cloud, wait_for @@ -10,7 +10,7 @@ @pytest.mark.cloud def test_template_react_ui_example_cloud() -> None: """This test ensures streamlit works in the cloud by clicking a button and checking the logs.""" - with run_app_in_cloud(os.path.join(_PROJECT_ROOT, "examples/app_template_react_ui")) as ( + with run_app_in_cloud(os.path.join(_PATH_APPS, "app_template_react_ui")) as ( _, view_page, fetch_logs, diff --git a/tests/tests_examples_app/test_template_streamlit_ui.py b/tests/tests_examples_app/public/test_template_streamlit_ui.py similarity index 86% rename from tests/tests_examples_app/test_template_streamlit_ui.py rename to tests/tests_examples_app/public/test_template_streamlit_ui.py index 30d6c38070988..1cdb7033e29bf 100644 --- a/tests/tests_examples_app/test_template_streamlit_ui.py +++ b/tests/tests_examples_app/public/test_template_streamlit_ui.py @@ -2,7 +2,7 @@ from time import sleep import pytest -from tests_app import _PROJECT_ROOT +from tests_examples_app.public import _PATH_APPS from lightning_app.testing.testing import run_app_in_cloud, wait_for @@ -10,7 +10,7 @@ @pytest.mark.cloud def test_template_streamlit_ui_example_cloud() -> None: """This test ensures streamlit works in the cloud by clicking a button and checking the logs.""" - with run_app_in_cloud(os.path.join(_PROJECT_ROOT, "examples/app_template_streamlit_ui")) as ( + with run_app_in_cloud(os.path.join(_PATH_APPS, "app_template_streamlit_ui")) as ( _, view_page, fetch_logs, diff --git a/tests/tests_examples_app/test_v0_app.py b/tests/tests_examples_app/public/test_v0_app.py similarity index 90% rename from tests/tests_examples_app/test_v0_app.py rename to tests/tests_examples_app/public/test_v0_app.py index b0b89eb99a17e..b05979f359959 100644 --- a/tests/tests_examples_app/test_v0_app.py +++ b/tests/tests_examples_app/public/test_v0_app.py @@ -3,7 +3,7 @@ from typing import Tuple import pytest -from tests_app import _PROJECT_ROOT +from tests_examples_app.public import _PATH_APPS from lightning_app.testing.testing import application_testing, LightningTestApp, run_app_in_cloud, wait_for from lightning_app.utilities.enum import AppStage @@ -20,7 +20,7 @@ def run_once(self) -> Tuple[bool, float]: def test_v0_app_example(): command_line = [ - os.path.join(_PROJECT_ROOT, "examples/app_v0/app.py"), + os.path.join(_PATH_APPS, "app_v0", "app.py"), "--blocking", "False", "--open-ui", @@ -59,7 +59,7 @@ def check_content(button_name, text_content): ) def test_v0_app_example_byoc_cloud() -> None: with run_app_in_cloud( - os.path.join(_PROJECT_ROOT, "examples/app_v0"), + os.path.join(_PATH_APPS, "app_v0"), extra_args=["--cluster-id", os.environ.get("LIGHTNING_BYOC_CLUSTER_ID")], ) as ( _, @@ -71,7 +71,7 @@ def test_v0_app_example_byoc_cloud() -> None: @pytest.mark.cloud def test_v0_app_example_cloud() -> None: - with run_app_in_cloud(os.path.join(_PROJECT_ROOT, "examples/app_v0")) as ( + with run_app_in_cloud(os.path.join(_PATH_APPS, "examples", "app_v0")) as ( _, view_page, fetch_logs, From b69f8e01742764af33380f9f60a74f3fce024f81 Mon Sep 17 00:00:00 2001 From: Jirka Date: Tue, 22 Nov 2022 16:30:18 +0100 Subject: [PATCH 03/12] clean --- tests/tests_examples_app/components/python/test_scripts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tests_examples_app/components/python/test_scripts.py b/tests/tests_examples_app/components/python/test_scripts.py index 53a083cf40ad6..d1cea3939136c 100644 --- a/tests/tests_examples_app/components/python/test_scripts.py +++ b/tests/tests_examples_app/components/python/test_scripts.py @@ -2,8 +2,8 @@ import pytest from click.testing import CliRunner -from tests_app import _PROJECT_ROOT +from lightning_app import _PROJECT_ROOT from lightning_app.cli.lightning_cli import run_app from lightning_app.testing.helpers import _run_script, _RunIf From a69073e62abbe638b5082469a595d389fb0c6e37 Mon Sep 17 00:00:00 2001 From: Jirka Date: Tue, 22 Nov 2022 16:36:54 +0100 Subject: [PATCH 04/12] path --- tests/tests_examples_app/components/__init__.py | 0 tests/tests_examples_app/components/python/__init__.py | 0 tests/tests_examples_app/public/__init__.py | 2 +- tests/tests_examples_app/public/test_app_dag.py | 4 ++-- tests/tests_examples_app/public/test_argparse.py | 4 ++-- tests/tests_examples_app/public/test_boring_app.py | 4 ++-- tests/tests_examples_app/public/test_commands_and_api.py | 4 ++-- tests/tests_examples_app/public/test_drive.py | 4 ++-- .../public/test_installation_commands_app.py | 4 ++-- tests/tests_examples_app/public/test_layout.py | 4 ++-- tests/tests_examples_app/public/test_multi_node.py | 6 +++--- tests/tests_examples_app/public/test_payload.py | 4 ++-- tests/tests_examples_app/public/test_pickle_or_not.py | 4 ++-- tests/tests_examples_app/public/test_quick_start.py | 6 +++--- .../{components/python => public}/test_scripts.py | 6 +++--- tests/tests_examples_app/public/test_template_react_ui.py | 4 ++-- .../public/test_template_streamlit_ui.py | 4 ++-- tests/tests_examples_app/public/test_v0_app.py | 8 ++++---- 18 files changed, 36 insertions(+), 36 deletions(-) delete mode 100644 tests/tests_examples_app/components/__init__.py delete mode 100644 tests/tests_examples_app/components/python/__init__.py rename tests/tests_examples_app/{components/python => public}/test_scripts.py (79%) diff --git a/tests/tests_examples_app/components/__init__.py b/tests/tests_examples_app/components/__init__.py deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/tests/tests_examples_app/components/python/__init__.py b/tests/tests_examples_app/components/python/__init__.py deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/tests/tests_examples_app/public/__init__.py b/tests/tests_examples_app/public/__init__.py index 05ad6aba65275..b70149ce10b11 100644 --- a/tests/tests_examples_app/public/__init__.py +++ b/tests/tests_examples_app/public/__init__.py @@ -2,4 +2,4 @@ from lightning_app import _PROJECT_ROOT -_PATH_APPS = os.path.join(_PROJECT_ROOT, "examples") +_PATH_EXAMPLES = os.path.join(_PROJECT_ROOT, "examples") diff --git a/tests/tests_examples_app/public/test_app_dag.py b/tests/tests_examples_app/public/test_app_dag.py index 39b38e01b3143..fb27c54a1a398 100644 --- a/tests/tests_examples_app/public/test_app_dag.py +++ b/tests/tests_examples_app/public/test_app_dag.py @@ -2,14 +2,14 @@ from time import sleep import pytest -from tests_examples_app.public import _PATH_APPS +from tests_examples_app.public import _PATH_EXAMPLES from lightning_app.testing.testing import run_app_in_cloud @pytest.mark.cloud def test_app_dag_example_cloud() -> None: - with run_app_in_cloud(os.path.join(_PATH_APPS, "app_dag")) as (_, _, fetch_logs, _): + with run_app_in_cloud(os.path.join(_PATH_EXAMPLES, "app_dag")) as (_, _, fetch_logs, _): launch_log, finish_log = False, False while not (launch_log and finish_log): diff --git a/tests/tests_examples_app/public/test_argparse.py b/tests/tests_examples_app/public/test_argparse.py index fe3f06d6c1a66..1e176884934db 100644 --- a/tests/tests_examples_app/public/test_argparse.py +++ b/tests/tests_examples_app/public/test_argparse.py @@ -1,7 +1,7 @@ import os import sys -from tests_examples_app.public import _PATH_APPS +from tests_examples_app.public import _PATH_EXAMPLES from lightning_app.testing.testing import application_testing from lightning_app.utilities.load_app import _patch_sys_argv @@ -11,7 +11,7 @@ def test_app_argparse_example(): original_argv = sys.argv command_line = [ - os.path.join(_PATH_APPS, "app_argparse", "app.py"), + os.path.join(_PATH_EXAMPLES, "app_argparse", "app.py"), "--app_args", "--use_gpu", "--without-server", diff --git a/tests/tests_examples_app/public/test_boring_app.py b/tests/tests_examples_app/public/test_boring_app.py index 3fa76937249cf..a97bccb93229b 100644 --- a/tests/tests_examples_app/public/test_boring_app.py +++ b/tests/tests_examples_app/public/test_boring_app.py @@ -2,7 +2,7 @@ import pytest from click.testing import CliRunner -from tests_examples_app.public import _PATH_APPS +from tests_examples_app.public import _PATH_EXAMPLES from lightning_app.cli.lightning_cli import show from lightning_app.testing.testing import run_app_in_cloud, wait_for @@ -10,7 +10,7 @@ @pytest.mark.cloud def test_boring_app_example_cloud() -> None: - with run_app_in_cloud(os.path.join(_PATH_APPS, "app_boring"), app_name="app_dynamic.py", debug=True,) as ( + with run_app_in_cloud(os.path.join(_PATH_EXAMPLES, "app_boring"), app_name="app_dynamic.py", debug=True,) as ( _, view_page, _, diff --git a/tests/tests_examples_app/public/test_commands_and_api.py b/tests/tests_examples_app/public/test_commands_and_api.py index b81ebdc372320..3105624432b78 100644 --- a/tests/tests_examples_app/public/test_commands_and_api.py +++ b/tests/tests_examples_app/public/test_commands_and_api.py @@ -4,7 +4,7 @@ import pytest import requests -from tests_examples_app.public import _PATH_APPS +from tests_examples_app.public import _PATH_EXAMPLES from lightning_app.testing.testing import run_app_in_cloud @@ -12,7 +12,7 @@ @pytest.mark.timeout(300) @pytest.mark.cloud def test_commands_and_api_example_cloud() -> None: - with run_app_in_cloud(os.path.join(_PATH_APPS, "app_commands_and_api")) as ( + with run_app_in_cloud(os.path.join(_PATH_EXAMPLES, "app_commands_and_api")) as ( admin_page, view_page, fetch_logs, diff --git a/tests/tests_examples_app/public/test_drive.py b/tests/tests_examples_app/public/test_drive.py index b9d6426c6f1a2..cdf699ad9f8d4 100644 --- a/tests/tests_examples_app/public/test_drive.py +++ b/tests/tests_examples_app/public/test_drive.py @@ -2,14 +2,14 @@ from time import sleep import pytest -from tests_examples_app.public import _PATH_APPS +from tests_examples_app.public import _PATH_EXAMPLES from lightning_app.testing.testing import run_app_in_cloud @pytest.mark.cloud def test_drive_example_cloud() -> None: - with run_app_in_cloud(os.path.join(_PATH_APPS, "app_drive")) as ( + with run_app_in_cloud(os.path.join(_PATH_EXAMPLES, "app_drive")) as ( _, _, fetch_logs, diff --git a/tests/tests_examples_app/public/test_installation_commands_app.py b/tests/tests_examples_app/public/test_installation_commands_app.py index 2ae2fbf5a7cd4..b303a3938c3a6 100644 --- a/tests/tests_examples_app/public/test_installation_commands_app.py +++ b/tests/tests_examples_app/public/test_installation_commands_app.py @@ -1,7 +1,7 @@ import os import pytest -from tests_examples_app.public import _PATH_APPS +from tests_examples_app.public import _PATH_EXAMPLES from lightning_app.testing.testing import run_app_in_cloud @@ -10,7 +10,7 @@ def test_installation_commands_app_example_cloud() -> None: # This is expected to pass, since the "setup" flag is passed with run_app_in_cloud( - os.path.join(_PATH_APPS, "app_installation_commands"), + os.path.join(_PATH_EXAMPLES, "app_installation_commands"), app_name="app.py", extra_args=["--setup"], debug=True, diff --git a/tests/tests_examples_app/public/test_layout.py b/tests/tests_examples_app/public/test_layout.py index 54b768aeaa276..7a44a8060bfc0 100644 --- a/tests/tests_examples_app/public/test_layout.py +++ b/tests/tests_examples_app/public/test_layout.py @@ -1,7 +1,7 @@ import os from click.testing import CliRunner -from tests_examples_app.public import _PATH_APPS +from tests_examples_app.public import _PATH_EXAMPLES from lightning_app.cli.lightning_cli import run_app @@ -12,7 +12,7 @@ def test_layout_example(): result = runner.invoke( run_app, [ - os.path.join(_PATH_APPS, "app_layout", "app.py"), + os.path.join(_PATH_EXAMPLES, "app_layout", "app.py"), "--blocking", "False", "--open-ui", diff --git a/tests/tests_examples_app/public/test_multi_node.py b/tests/tests_examples_app/public/test_multi_node.py index 546146f701a8c..79fd491b98751 100644 --- a/tests/tests_examples_app/public/test_multi_node.py +++ b/tests/tests_examples_app/public/test_multi_node.py @@ -2,7 +2,7 @@ import sys import pytest -from tests_examples_app.public import _PATH_APPS +from tests_examples_app.public import _PATH_EXAMPLES from lightning_app.testing.testing import application_testing, LightningTestApp @@ -18,7 +18,7 @@ def on_before_run_once(self): @pytest.mark.skip(reason="flaky") def test_multi_node_example(monkeypatch): - monkeypatch.chdir(os.path.join(_PATH_APPS, "app_multi_node")) + monkeypatch.chdir(os.path.join(_PATH_EXAMPLES, "app_multi_node")) command_line = [ "app.py", "--blocking", @@ -51,7 +51,7 @@ def on_before_run_once(self): ) @pytest.mark.skipif(sys.platform == "win32", reason="flaky") def test_multi_node_examples(app_name, monkeypatch): - monkeypatch.chdir(os.path.join(_PATH_APPS, "app_multi_node")) + monkeypatch.chdir(os.path.join(_PATH_EXAMPLES, "app_multi_node")) command_line = [ app_name, "--blocking", diff --git a/tests/tests_examples_app/public/test_payload.py b/tests/tests_examples_app/public/test_payload.py index 73b6c8063a687..501c0a298b681 100644 --- a/tests/tests_examples_app/public/test_payload.py +++ b/tests/tests_examples_app/public/test_payload.py @@ -2,14 +2,14 @@ from time import sleep import pytest -from tests_examples_app.public import _PATH_APPS +from tests_examples_app.public import _PATH_EXAMPLES from lightning_app.testing.testing import run_app_in_cloud @pytest.mark.cloud def test_payload_example_cloud() -> None: - with run_app_in_cloud(os.path.join(_PATH_APPS, "app_payload")) as (_, _, fetch_logs, _): + with run_app_in_cloud(os.path.join(_PATH_EXAMPLES, "app_payload")) as (_, _, fetch_logs, _): has_logs = False while not has_logs: diff --git a/tests/tests_examples_app/public/test_pickle_or_not.py b/tests/tests_examples_app/public/test_pickle_or_not.py index c3a175309da29..c834b193a73d4 100644 --- a/tests/tests_examples_app/public/test_pickle_or_not.py +++ b/tests/tests_examples_app/public/test_pickle_or_not.py @@ -1,7 +1,7 @@ import os from click.testing import CliRunner -from tests_examples_app.public import _PATH_APPS +from tests_examples_app.public import _PATH_EXAMPLES from lightning_app.cli.lightning_cli import run_app @@ -12,7 +12,7 @@ def test_pickle_or_not_example(): result = runner.invoke( run_app, [ - os.path.join(_PATH_APPS, "app_pickle_or_not", "app.py"), + os.path.join(_PATH_EXAMPLES, "app_pickle_or_not", "app.py"), "--blocking", "False", "--open-ui", diff --git a/tests/tests_examples_app/public/test_quick_start.py b/tests/tests_examples_app/public/test_quick_start.py index e6bf63808e7b2..9477442022918 100644 --- a/tests/tests_examples_app/public/test_quick_start.py +++ b/tests/tests_examples_app/public/test_quick_start.py @@ -4,7 +4,7 @@ import pytest from click.testing import CliRunner -from tests_examples_app.public import _PATH_APPS +from tests_examples_app.public import _PATH_EXAMPLES from lightning_app import LightningApp from lightning_app.cli.lightning_cli import run_app @@ -38,7 +38,7 @@ def test_quick_start_example(caplog, monkeypatch): result = runner.invoke( run_app, [ - os.path.join(_PATH_APPS, "lightning-quick-start", "app.py"), + os.path.join(_PATH_EXAMPLES, "lightning-quick-start", "app.py"), "--blocking", "False", "--open-ui", @@ -51,7 +51,7 @@ def test_quick_start_example(caplog, monkeypatch): @pytest.mark.cloud def test_quick_start_example_cloud() -> None: - with run_app_in_cloud(os.path.join(_PATH_APPS, "lightning-quick-start")) as (_, view_page, _, _): + with run_app_in_cloud(os.path.join(_PATH_EXAMPLES, "lightning-quick-start")) as (_, view_page, _, _): def click_gradio_demo(*_, **__): button = view_page.locator('button:has-text("Interactive demo")') diff --git a/tests/tests_examples_app/components/python/test_scripts.py b/tests/tests_examples_app/public/test_scripts.py similarity index 79% rename from tests/tests_examples_app/components/python/test_scripts.py rename to tests/tests_examples_app/public/test_scripts.py index d1cea3939136c..d57731acb9d55 100644 --- a/tests/tests_examples_app/components/python/test_scripts.py +++ b/tests/tests_examples_app/public/test_scripts.py @@ -2,8 +2,8 @@ import pytest from click.testing import CliRunner +from tests_examples_app.public import _PATH_EXAMPLES -from lightning_app import _PROJECT_ROOT from lightning_app.cli.lightning_cli import run_app from lightning_app.testing.helpers import _run_script, _RunIf @@ -17,7 +17,7 @@ ], ) def test_scripts(file): - _run_script(str(os.path.join(_PROJECT_ROOT, f"examples/app_components/python/{file}"))) + _run_script(str(os.path.join(_PATH_EXAMPLES, f"app_components/python/{file}"))) @pytest.mark.skip(reason="causing some issues with CI, not sure if the test is actually needed") @@ -28,7 +28,7 @@ def test_components_app_example(): result = runner.invoke( run_app, [ - os.path.join(_PROJECT_ROOT, "examples/app_components/python/app.py"), + os.path.join(_PATH_EXAMPLES, "app_components/python/app.py"), "--blocking", "False", "--open-ui", diff --git a/tests/tests_examples_app/public/test_template_react_ui.py b/tests/tests_examples_app/public/test_template_react_ui.py index 143d7a00731c9..426e94195f7fd 100644 --- a/tests/tests_examples_app/public/test_template_react_ui.py +++ b/tests/tests_examples_app/public/test_template_react_ui.py @@ -2,7 +2,7 @@ from time import sleep import pytest -from tests_examples_app.public import _PATH_APPS +from tests_examples_app.public import _PATH_EXAMPLES from lightning_app.testing.testing import run_app_in_cloud, wait_for @@ -10,7 +10,7 @@ @pytest.mark.cloud def test_template_react_ui_example_cloud() -> None: """This test ensures streamlit works in the cloud by clicking a button and checking the logs.""" - with run_app_in_cloud(os.path.join(_PATH_APPS, "app_template_react_ui")) as ( + with run_app_in_cloud(os.path.join(_PATH_EXAMPLES, "app_template_react_ui")) as ( _, view_page, fetch_logs, diff --git a/tests/tests_examples_app/public/test_template_streamlit_ui.py b/tests/tests_examples_app/public/test_template_streamlit_ui.py index 1cdb7033e29bf..c78022d4c878c 100644 --- a/tests/tests_examples_app/public/test_template_streamlit_ui.py +++ b/tests/tests_examples_app/public/test_template_streamlit_ui.py @@ -2,7 +2,7 @@ from time import sleep import pytest -from tests_examples_app.public import _PATH_APPS +from tests_examples_app.public import _PATH_EXAMPLES from lightning_app.testing.testing import run_app_in_cloud, wait_for @@ -10,7 +10,7 @@ @pytest.mark.cloud def test_template_streamlit_ui_example_cloud() -> None: """This test ensures streamlit works in the cloud by clicking a button and checking the logs.""" - with run_app_in_cloud(os.path.join(_PATH_APPS, "app_template_streamlit_ui")) as ( + with run_app_in_cloud(os.path.join(_PATH_EXAMPLES, "app_template_streamlit_ui")) as ( _, view_page, fetch_logs, diff --git a/tests/tests_examples_app/public/test_v0_app.py b/tests/tests_examples_app/public/test_v0_app.py index b05979f359959..f6e46666c62a3 100644 --- a/tests/tests_examples_app/public/test_v0_app.py +++ b/tests/tests_examples_app/public/test_v0_app.py @@ -3,7 +3,7 @@ from typing import Tuple import pytest -from tests_examples_app.public import _PATH_APPS +from tests_examples_app.public import _PATH_EXAMPLES from lightning_app.testing.testing import application_testing, LightningTestApp, run_app_in_cloud, wait_for from lightning_app.utilities.enum import AppStage @@ -20,7 +20,7 @@ def run_once(self) -> Tuple[bool, float]: def test_v0_app_example(): command_line = [ - os.path.join(_PATH_APPS, "app_v0", "app.py"), + os.path.join(_PATH_EXAMPLES, "app_v0", "app.py"), "--blocking", "False", "--open-ui", @@ -59,7 +59,7 @@ def check_content(button_name, text_content): ) def test_v0_app_example_byoc_cloud() -> None: with run_app_in_cloud( - os.path.join(_PATH_APPS, "app_v0"), + os.path.join(_PATH_EXAMPLES, "app_v0"), extra_args=["--cluster-id", os.environ.get("LIGHTNING_BYOC_CLUSTER_ID")], ) as ( _, @@ -71,7 +71,7 @@ def test_v0_app_example_byoc_cloud() -> None: @pytest.mark.cloud def test_v0_app_example_cloud() -> None: - with run_app_in_cloud(os.path.join(_PATH_APPS, "examples", "app_v0")) as ( + with run_app_in_cloud(os.path.join(_PATH_EXAMPLES, "app_v0")) as ( _, view_page, fetch_logs, From ca0b25df49d333da91f4512f199072738e03f511 Mon Sep 17 00:00:00 2001 From: Jirka Date: Tue, 22 Nov 2022 17:23:38 +0100 Subject: [PATCH 05/12] add inits --- tests/tests_examples_app/apps/collect_failures/__init__.py | 1 + tests/tests_examples_app/apps/core_features_app/__init__.py | 1 + .../tests_examples_app/apps/custom_work_dependencies/__init__.py | 1 + tests/tests_examples_app/apps/idle_timeout/__init__.py | 1 + 4 files changed, 4 insertions(+) create mode 100644 tests/tests_examples_app/apps/collect_failures/__init__.py create mode 100644 tests/tests_examples_app/apps/core_features_app/__init__.py create mode 100644 tests/tests_examples_app/apps/custom_work_dependencies/__init__.py create mode 100644 tests/tests_examples_app/apps/idle_timeout/__init__.py diff --git a/tests/tests_examples_app/apps/collect_failures/__init__.py b/tests/tests_examples_app/apps/collect_failures/__init__.py new file mode 100644 index 0000000000000..b022c62adcdf3 --- /dev/null +++ b/tests/tests_examples_app/apps/collect_failures/__init__.py @@ -0,0 +1 @@ +# TODO: check the tests to be able to run without this init file diff --git a/tests/tests_examples_app/apps/core_features_app/__init__.py b/tests/tests_examples_app/apps/core_features_app/__init__.py new file mode 100644 index 0000000000000..b022c62adcdf3 --- /dev/null +++ b/tests/tests_examples_app/apps/core_features_app/__init__.py @@ -0,0 +1 @@ +# TODO: check the tests to be able to run without this init file diff --git a/tests/tests_examples_app/apps/custom_work_dependencies/__init__.py b/tests/tests_examples_app/apps/custom_work_dependencies/__init__.py new file mode 100644 index 0000000000000..b022c62adcdf3 --- /dev/null +++ b/tests/tests_examples_app/apps/custom_work_dependencies/__init__.py @@ -0,0 +1 @@ +# TODO: check the tests to be able to run without this init file diff --git a/tests/tests_examples_app/apps/idle_timeout/__init__.py b/tests/tests_examples_app/apps/idle_timeout/__init__.py new file mode 100644 index 0000000000000..b022c62adcdf3 --- /dev/null +++ b/tests/tests_examples_app/apps/idle_timeout/__init__.py @@ -0,0 +1 @@ +# TODO: check the tests to be able to run without this init file From b0c89c2446e030f60f6c64e4435e8d8cc0408f46 Mon Sep 17 00:00:00 2001 From: Jirka Date: Tue, 22 Nov 2022 17:34:57 +0100 Subject: [PATCH 06/12] skip --- tests/tests_examples_app/public/test_pickle_or_not.py | 3 +++ tests/tests_examples_app/public/test_quick_start.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/tests_examples_app/public/test_pickle_or_not.py b/tests/tests_examples_app/public/test_pickle_or_not.py index c834b193a73d4..8e64da650a877 100644 --- a/tests/tests_examples_app/public/test_pickle_or_not.py +++ b/tests/tests_examples_app/public/test_pickle_or_not.py @@ -1,11 +1,14 @@ import os +import pytest from click.testing import CliRunner from tests_examples_app.public import _PATH_EXAMPLES from lightning_app.cli.lightning_cli import run_app +# TODO: Investigate why it doesn't work +@pytest.mark.skip(reason="test has been ignored for a while and seems not to be working :(") def test_pickle_or_not_example(): runner = CliRunner() diff --git a/tests/tests_examples_app/public/test_quick_start.py b/tests/tests_examples_app/public/test_quick_start.py index 9477442022918..9e43802d991fe 100644 --- a/tests/tests_examples_app/public/test_quick_start.py +++ b/tests/tests_examples_app/public/test_quick_start.py @@ -25,7 +25,7 @@ def run_once(self): # TODO: Investigate why it doesn't work -@pytest.mark.skipif(True, reason="test is skipped because CI was blocking all the PRs.") +@pytest.mark.skip(reason="test is skipped because CI was blocking all the PRs.") @_RunIf(pl=True, skip_windows=True, skip_linux=True) def test_quick_start_example(caplog, monkeypatch): """This test ensures the Quick Start example properly train and serve PyTorch Lightning.""" From c1166e497485918dd0744ce9ce0300430504b853 Mon Sep 17 00:00:00 2001 From: Jirka Date: Tue, 22 Nov 2022 17:53:45 +0100 Subject: [PATCH 07/12] e2e --- .azure/app-cloud-e2e.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.azure/app-cloud-e2e.yml b/.azure/app-cloud-e2e.yml index bbcf7f4cea50c..bede37a20cccf 100644 --- a/.azure/app-cloud-e2e.yml +++ b/.azure/app-cloud-e2e.yml @@ -27,14 +27,13 @@ pr: - "release/*" paths: include: + - ".actions/**" - ".azure/app-cloud-e2e.yml" - - "requirements/app/**" - "src/lightning_app/**" - - "tests/tests_app/**" - "examples/app_*/**" # some tests_app tests call examples files + - "requirements/app/**" - "tests/tests_examples_app/**" - "setup.py" - - ".actions/**" exclude: - "requirements/app/docs.txt" - "*.md" @@ -152,8 +151,9 @@ jobs: - bash: | mkdir -p ${VIDEO_LOCATION} ls -l examples/${TEST_APP_NAME} - ls -l tests/tests_examples_app - python -m pytest tests/tests_examples_app/test_${TEST_APP_NAME}.py::test_${TEST_APP_NAME}_example_cloud --timeout=1200 --capture=no -v --color=yes + ls -l tests/tests_examples_app/public + python -m pytest tests/tests_examples_app/public/test_${TEST_APP_NAME}.py::test_${TEST_APP_NAME}_example_cloud \ + --timeout=1200 --capture=no -v --color=yes env: HEADLESS: '1' PACKAGE_LIGHTNING: '1' From 906b6f383c7a9735b28def98c8684cefe6bc7776 Mon Sep 17 00:00:00 2001 From: Jirka Date: Tue, 22 Nov 2022 18:30:19 +0100 Subject: [PATCH 08/12] azure --- .azure/app-cloud-e2e.yml | 3 ++- .azure/gpu-benchmark.yml | 2 +- .azure/gpu-tests-lite.yml | 4 ++-- .azure/gpu-tests-pytorch.yml | 5 +++-- .azure/hpu-tests.yml | 5 +++-- .azure/ipu-tests.yml | 5 +++-- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.azure/app-cloud-e2e.yml b/.azure/app-cloud-e2e.yml index bede37a20cccf..33e3fddc10a10 100644 --- a/.azure/app-cloud-e2e.yml +++ b/.azure/app-cloud-e2e.yml @@ -33,9 +33,10 @@ pr: - "examples/app_*/**" # some tests_app tests call examples files - "requirements/app/**" - "tests/tests_examples_app/**" + - "setup.cfg" # this includes pytest configuration - "setup.py" exclude: - - "requirements/app/docs.txt" + - "requirements/*/docs.txt" - "*.md" - "**/*.md" diff --git a/.azure/gpu-benchmark.yml b/.azure/gpu-benchmark.yml index 6d16dcaf7ace5..bcd925e1d267e 100644 --- a/.azure/gpu-benchmark.yml +++ b/.azure/gpu-benchmark.yml @@ -24,7 +24,7 @@ pr: - "tests/tests_pytorch/benchmarks/**" - "requirements/pytorch/**" exclude: - - "requirements/pytorch/docs.txt" + - "requirements/*/docs.txt" - "*.md" - "**/*.md" diff --git a/.azure/gpu-tests-lite.yml b/.azure/gpu-tests-lite.yml index 608390de776cc..4545f77f73056 100644 --- a/.azure/gpu-tests-lite.yml +++ b/.azure/gpu-tests-lite.yml @@ -20,6 +20,7 @@ pr: - "release/*" paths: include: + - ".actions/**" - ".azure/gpu-tests-lite.yml" - "examples/lite/**" - "examples/run_lite_examples.sh" @@ -29,9 +30,8 @@ pr: - "src/lightning_lite/**" - "tests/tests_lite/**" - "setup.cfg" # includes pytest config - - ".actions/**" exclude: - - "requirements/lite/docs.txt" + - "requirements/*/docs.txt" - "*.md" - "**/*.md" diff --git a/.azure/gpu-tests-pytorch.yml b/.azure/gpu-tests-pytorch.yml index 8107d692be23b..e572b0bb7752a 100644 --- a/.azure/gpu-tests-pytorch.yml +++ b/.azure/gpu-tests-pytorch.yml @@ -20,6 +20,7 @@ pr: - "release/*" paths: include: + - ".actions/**" - ".azure/gpu-tests-pytorch.yml" - "examples/run_pl_examples.sh" - "examples/pl_basics/backbone_image_classifier.py" @@ -31,11 +32,11 @@ pr: - "src/pytorch_lightning/**" - "tests/tests_pytorch/**" - "setup.cfg" # includes pytest config + - "setup.py" - "requirements/lite/**" - "src/lightning_lite/**" - - ".actions/**" exclude: - - "requirements/**/docs.txt" + - "requirements/*/docs.txt" - "*.md" - "**/*.md" diff --git a/.azure/hpu-tests.yml b/.azure/hpu-tests.yml index 6afedb6df6757..60f36a9176cbe 100644 --- a/.azure/hpu-tests.yml +++ b/.azure/hpu-tests.yml @@ -17,6 +17,7 @@ pr: - "release/*" paths: include: + - ".actions/**" - ".azure/hpu-tests.yml" - "examples/pl_hpu/mnist_sample.py" - "requirements/lite/**" @@ -25,9 +26,9 @@ pr: - "src/pytorch_lightning/**" - "tests/tests_pytorch/**" - "setup.cfg" # includes pytest config - - ".actions/**" + - "setup.py" exclude: - - "requirements/**/docs.txt" + - "requirements/*/docs.txt" - "*.md" - "**/*.md" diff --git a/.azure/ipu-tests.yml b/.azure/ipu-tests.yml index fc292b25cbfd4..b31f41984ab38 100644 --- a/.azure/ipu-tests.yml +++ b/.azure/ipu-tests.yml @@ -15,6 +15,7 @@ pr: - "release/*" paths: include: + - ".actions/**" - ".azure/ipu-tests.yml" - "requirements/lite/**" - "src/lightning_lite/**" @@ -22,9 +23,9 @@ pr: - "src/pytorch_lightning/**" - "tests/tests_pytorch/**" - "setup.cfg" # includes pytest config - - ".actions/**" + - "setup.py" exclude: - - "requirements/**/docs.txt" + - "requirements/*/docs.txt" - "*.md" - "**/*.md" From 8f9da6bb243b6e209f07415030db01acf7b421f2 Mon Sep 17 00:00:00 2001 From: Jirka Date: Tue, 22 Nov 2022 18:57:28 +0100 Subject: [PATCH 09/12] e2e --- .azure/app-cloud-e2e.yml | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/.azure/app-cloud-e2e.yml b/.azure/app-cloud-e2e.yml index 33e3fddc10a10..2c683c01599a8 100644 --- a/.azure/app-cloud-e2e.yml +++ b/.azure/app-cloud-e2e.yml @@ -59,30 +59,42 @@ jobs: matrix: 'App: v0_app': name: "v0_app" + dir: "public" 'App: boring_app': name: "boring_app" + dir: "public" 'App: template_streamlit_ui': name: "template_streamlit_ui" + dir: "public" 'App: template_react_ui': name: "template_react_ui" + dir: "public" # 'App: template_jupyterlab': # TODO: clarify where these files lives # name: "template_jupyterlab" - 'App: idle_timeout': - name: "idle_timeout" - 'App: collect_failures': - name: "collect_failures" - 'App: custom_work_dependencies': - name: "custom_work_dependencies" 'App: installation_commands_app': name: "installation_commands_app" + dir: "public" 'App: drive': name: "drive" + dir: "public" 'App: payload': name: "payload" + dir: "public" 'App: commands_and_api': name: "commands_and_api" + dir: "public" 'App: quick_start': name: "quick_start" + dir: "public" + 'App: idle_timeout': + name: "idle_timeout" + dir: "local" + 'App: collect_failures': + name: "collect_failures" + dir: "local" + 'App: custom_work_dependencies': + name: "custom_work_dependencies" + dir: "local" timeoutInMinutes: "20" cancelTimeoutInMinutes: "2" # values: https://docs.microsoft.com/en-us/azure/devops/pipelines/process/phases?view=azure-devops&tabs=yaml#workspace @@ -153,7 +165,7 @@ jobs: mkdir -p ${VIDEO_LOCATION} ls -l examples/${TEST_APP_NAME} ls -l tests/tests_examples_app/public - python -m pytest tests/tests_examples_app/public/test_${TEST_APP_NAME}.py::test_${TEST_APP_NAME}_example_cloud \ + python -m pytest tests/tests_examples_app/${TEST_APP_FOLDER}/test_${TEST_APP_NAME}.py::test_${TEST_APP_NAME}_example_cloud \ --timeout=1200 --capture=no -v --color=yes env: HEADLESS: '1' @@ -162,6 +174,7 @@ jobs: VIDEO_LOCATION: $(video_artifact_dir) PR_NUMBER: $(local_id) TEST_APP_NAME: $(name) + TEST_APP_FOLDER: $(dir) HAR_LOCATION: './artifacts/hars' SLOW_MO: '50' #LAI_USER: $(LAI_USER) # for STAGING @@ -192,6 +205,7 @@ jobs: LIGHTNING_CLOUD_URL: $(LIGHTNING_CLOUD_URL_PROD) PR_NUMBER: $(local_id) TEST_APP_NAME: $(name) + TEST_APP_FOLDER: $(dir) # GRID_USER_ID: $(LIGHTNING_USER_ID) # TODO: clarify the meaning # GRID_USER_KEY: $(LIGHTNING_API_KEY) # TODO: clarify the meaning # GRID_URL: $(LIGHTNING_CLOUD_URL) From d45d5c8df43f13114dee30e08dd77a4fa952658c Mon Sep 17 00:00:00 2001 From: Jirka Date: Tue, 22 Nov 2022 19:26:12 +0100 Subject: [PATCH 10/12] rev --- .azure/app-cloud-e2e.yml | 1 - .azure/gpu-tests-pytorch.yml | 1 - .azure/hpu-tests.yml | 1 - .azure/ipu-tests.yml | 1 - 4 files changed, 4 deletions(-) diff --git a/.azure/app-cloud-e2e.yml b/.azure/app-cloud-e2e.yml index 2c683c01599a8..ec11400089e4b 100644 --- a/.azure/app-cloud-e2e.yml +++ b/.azure/app-cloud-e2e.yml @@ -33,7 +33,6 @@ pr: - "examples/app_*/**" # some tests_app tests call examples files - "requirements/app/**" - "tests/tests_examples_app/**" - - "setup.cfg" # this includes pytest configuration - "setup.py" exclude: - "requirements/*/docs.txt" diff --git a/.azure/gpu-tests-pytorch.yml b/.azure/gpu-tests-pytorch.yml index e572b0bb7752a..be92b6ecd5f26 100644 --- a/.azure/gpu-tests-pytorch.yml +++ b/.azure/gpu-tests-pytorch.yml @@ -32,7 +32,6 @@ pr: - "src/pytorch_lightning/**" - "tests/tests_pytorch/**" - "setup.cfg" # includes pytest config - - "setup.py" - "requirements/lite/**" - "src/lightning_lite/**" exclude: diff --git a/.azure/hpu-tests.yml b/.azure/hpu-tests.yml index 60f36a9176cbe..2935f72e2b437 100644 --- a/.azure/hpu-tests.yml +++ b/.azure/hpu-tests.yml @@ -26,7 +26,6 @@ pr: - "src/pytorch_lightning/**" - "tests/tests_pytorch/**" - "setup.cfg" # includes pytest config - - "setup.py" exclude: - "requirements/*/docs.txt" - "*.md" diff --git a/.azure/ipu-tests.yml b/.azure/ipu-tests.yml index b31f41984ab38..97948469e17e5 100644 --- a/.azure/ipu-tests.yml +++ b/.azure/ipu-tests.yml @@ -23,7 +23,6 @@ pr: - "src/pytorch_lightning/**" - "tests/tests_pytorch/**" - "setup.cfg" # includes pytest config - - "setup.py" exclude: - "requirements/*/docs.txt" - "*.md" From 9fea7362b65315969b17b36e9cfedf8010f26d68 Mon Sep 17 00:00:00 2001 From: Jirka Date: Tue, 22 Nov 2022 19:30:08 +0100 Subject: [PATCH 11/12] unify single depth for ignore docs req. --- .azure/gpu-benchmark.yml | 2 +- .azure/gpu-tests-lite.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.azure/gpu-benchmark.yml b/.azure/gpu-benchmark.yml index bcd925e1d267e..6d16dcaf7ace5 100644 --- a/.azure/gpu-benchmark.yml +++ b/.azure/gpu-benchmark.yml @@ -24,7 +24,7 @@ pr: - "tests/tests_pytorch/benchmarks/**" - "requirements/pytorch/**" exclude: - - "requirements/*/docs.txt" + - "requirements/pytorch/docs.txt" - "*.md" - "**/*.md" diff --git a/.azure/gpu-tests-lite.yml b/.azure/gpu-tests-lite.yml index 4545f77f73056..e7ea5b6e670f4 100644 --- a/.azure/gpu-tests-lite.yml +++ b/.azure/gpu-tests-lite.yml @@ -31,7 +31,7 @@ pr: - "tests/tests_lite/**" - "setup.cfg" # includes pytest config exclude: - - "requirements/*/docs.txt" + - "requirements/lite/docs.txt" - "*.md" - "**/*.md" From 39be00b77f05faafd93b51d6639709ebd9ce76a8 Mon Sep 17 00:00:00 2001 From: Jirka Date: Tue, 22 Nov 2022 19:41:17 +0100 Subject: [PATCH 12/12] group --- .github/checkgroup.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/checkgroup.yml b/.github/checkgroup.yml index 5e8d2ff18353e..1d1ef2d6439a1 100644 --- a/.github/checkgroup.yml +++ b/.github/checkgroup.yml @@ -269,7 +269,6 @@ subprojects: - ".azure/app-cloud-e2e.yml" - "requirements/app/**" - "src/lightning_app/**" - - "tests/tests_app/**" - "examples/app_*/**" # some tests_app tests call examples files - "tests/tests_examples_app/**" - "setup.py"