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

Use dynamic version of py-shiny for deploy tests #970

Merged
merged 6 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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 .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Run example app tests
- name: Run tests for deploys
env:
DEPLOY_CONNECT_SERVER_URL: "https://rsc.radixu.com/"
DEPLOY_CONNECT_SERVER_API_KEY: "${{ secrets.DEPLOY_CONNECT_SERVER_API_KEY }}"
Expand Down
1 change: 0 additions & 1 deletion tests/playwright/deploys/apps/plotly_app/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
pandas
plotly
git+https://github.com/posit-dev/py-shiny.git#egg=shiny
git+https://github.com/posit-dev/py-htmltools.git#egg=htmltools
git+https://github.com/posit-dev/py-shinywidgets.git#egg=shinywidgets
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
git+https://github.com/posit-dev/py-shiny
git+https://github.com/posit-dev/py-htmltools.git#egg=htmltools
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
git+https://github.com/posit-dev/py-shiny
git+https://github.com/posit-dev/py-htmltools.git#egg=htmltools
pandas
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
git+https://github.com/posit-dev/py-shiny
git+https://github.com/posit-dev/py-htmltools.git#egg=htmltools
folium
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
git+https://github.com/posit-dev/py-shiny
git+https://github.com/posit-dev/py-htmltools.git#egg=htmltools
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
git+https://github.com/posit-dev/py-shiny
git+https://github.com/posit-dev/py-htmltools.git#egg=htmltools
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
git+https://github.com/posit-dev/py-shiny
git+https://github.com/posit-dev/py-htmltools.git#egg=htmltools
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
git+https://github.com/posit-dev/py-shiny
git+https://github.com/posit-dev/py-htmltools.git#egg=htmltools
3 changes: 2 additions & 1 deletion tests/playwright/deploys/tests/test_accordion.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest
from playwright.sync_api import Page
from utils.deploy_utils import deploy
from utils.deploy_utils import deploy, tweak_requirements_txt
from utils.express_utils import verify_express_accordion

APP_DIR = "shiny-express-accordion"
Expand All @@ -17,6 +17,7 @@
@pytest.mark.only_browser("chromium")
@pytest.mark.parametrize("location", ["connect", "shinyapps"])
def test_express_accordion(page: Page, location: str) -> None:
tweak_requirements_txt(app_file_path)
page_url = deploy(location, APP_NAME, app_file_path)
page.goto(page_url, timeout=PAGE_TIMEOUT)
verify_express_accordion(page)
3 changes: 2 additions & 1 deletion tests/playwright/deploys/tests/test_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest
from playwright.sync_api import Page
from utils.deploy_utils import deploy
from utils.deploy_utils import deploy, tweak_requirements_txt
from utils.express_utils import verify_express_dataframe

APP_DIR = "shiny-express-dataframe"
Expand All @@ -17,6 +17,7 @@
@pytest.mark.only_browser("chromium")
@pytest.mark.parametrize("location", ["connect", "shinyapps"])
def test_express_dataframe(page: Page, location: str) -> None:
tweak_requirements_txt(app_file_path)
page_url = deploy(location, APP_NAME, app_file_path)
page.goto(page_url, timeout=PAGE_TIMEOUT)
verify_express_dataframe(page)
3 changes: 2 additions & 1 deletion tests/playwright/deploys/tests/test_folium.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest
from playwright.sync_api import Page
from utils.deploy_utils import deploy
from utils.deploy_utils import deploy, tweak_requirements_txt
from utils.express_utils import verify_express_folium_render

APP_DIR = "shiny-express-folium"
Expand All @@ -17,6 +17,7 @@
@pytest.mark.only_browser("chromium")
@pytest.mark.parametrize("location", ["connect", "shinyapps"])
def test_folium_map(page: Page, location: str) -> None:
tweak_requirements_txt(app_file_path)
page_url = deploy(location, APP_NAME, app_file_path)
page.goto(page_url, timeout=PAGE_TIMEOUT)
verify_express_folium_render(page)
3 changes: 2 additions & 1 deletion tests/playwright/deploys/tests/test_page_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest
from playwright.sync_api import Page
from utils.deploy_utils import deploy
from utils.deploy_utils import deploy, tweak_requirements_txt
from utils.express_utils import verify_express_page_default

APP_DIR = "shiny-express-page-default"
Expand All @@ -20,6 +20,7 @@
@pytest.mark.only_browser("chromium")
@pytest.mark.parametrize("location", ["connect", "shinyapps"])
def test_express_page_default(page: Page, location: str) -> None:
tweak_requirements_txt(app_file_path)
page_url = deploy(location, APP_NAME, app_file_path)
page.goto(page_url, timeout=PAGE_TIMEOUT)
verify_express_page_default(page)
3 changes: 2 additions & 1 deletion tests/playwright/deploys/tests/test_page_fillable.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest
from playwright.sync_api import Page
from utils.deploy_utils import deploy
from utils.deploy_utils import deploy, tweak_requirements_txt
from utils.express_utils import verify_express_page_fillable

APP_DIR = "shiny-express-page-fillable"
Expand All @@ -20,6 +20,7 @@
@pytest.mark.only_browser("chromium")
@pytest.mark.parametrize("location", ["connect", "shinyapps"])
def test_express_page_fillable(page: Page, location: str) -> None:
tweak_requirements_txt(app_file_path)
page_url = deploy(location, APP_NAME, app_file_path)
page.goto(page_url, timeout=PAGE_TIMEOUT)
verify_express_page_fillable(page)
3 changes: 2 additions & 1 deletion tests/playwright/deploys/tests/test_page_fluid.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest
from playwright.sync_api import Page
from utils.deploy_utils import deploy
from utils.deploy_utils import deploy, tweak_requirements_txt
from utils.express_utils import verify_express_page_fluid

APP_DIR = "shiny-express-page-fluid"
Expand All @@ -20,6 +20,7 @@
@pytest.mark.only_browser("chromium")
@pytest.mark.parametrize("location", ["connect", "shinyapps"])
def test_express_page_fluid(page: Page, location: str) -> None:
tweak_requirements_txt(app_file_path)
page_url = deploy(location, APP_NAME, app_file_path)
page.goto(page_url, timeout=PAGE_TIMEOUT)
verify_express_page_fluid(page)
3 changes: 2 additions & 1 deletion tests/playwright/deploys/tests/test_page_sidebar.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest
from playwright.sync_api import Page
from utils.deploy_utils import deploy
from utils.deploy_utils import deploy, tweak_requirements_txt
from utils.express_utils import verify_express_page_sidebar

APP_DIR = "shiny-express-page-sidebar"
Expand All @@ -20,6 +20,7 @@
@pytest.mark.only_browser("chromium")
@pytest.mark.parametrize("location", ["connect", "shinyapps"])
def test_express_page_sidebar(page: Page, location: str) -> None:
tweak_requirements_txt(app_file_path)
page_url = deploy(location, APP_NAME, app_file_path)
page.goto(page_url, timeout=PAGE_TIMEOUT)
verify_express_page_sidebar(page)
3 changes: 2 additions & 1 deletion tests/playwright/deploys/tests/test_plotly_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest
from playwright.sync_api import Page, expect
from utils.deploy_utils import deploy
from utils.deploy_utils import deploy, tweak_requirements_txt

COUNTRY = "Afghanistan"
APP_DIR = "plotly_app"
Expand All @@ -20,6 +20,7 @@
@pytest.mark.only_browser("chromium")
@pytest.mark.parametrize("location", ["connect", "shinyapps"])
def test_deploys(page: Page, location: str) -> None:
tweak_requirements_txt(app_file_path)
page_url = deploy(location, APP_NAME, app_file_path)
page.goto(page_url, timeout=PAGE_TIMEOUT)

Expand Down
9 changes: 9 additions & 0 deletions tests/playwright/utils/deploy_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,12 @@ def deploy(location: str, app_name: str, app_file_path: str) -> str:
else:
raise ValueError("Unknown deploy location. Cannot deploy.")
return url


# Since connect parses python packages, we need to get latest version of shiny on main
def tweak_requirements_txt(app_file_path: str) -> None:
schloerke marked this conversation as resolved.
Show resolved Hide resolved
requirements_file_path = os.path.join(app_file_path, "requirements.txt")
karangattu marked this conversation as resolved.
Show resolved Hide resolved
git_cmd = subprocess.run(["git", "rev-parse", "HEAD"], stdout=subprocess.PIPE)
git_hash = git_cmd.stdout.decode("utf-8").strip()
with open(requirements_file_path, "a") as f:
karangattu marked this conversation as resolved.
Show resolved Hide resolved
f.write(f"git+https://github.com/posit-dev/py-shiny.git@{git_hash}\n")
Loading