Skip to content
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
8 changes: 5 additions & 3 deletions .github/workflows/build-wheels-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ on:
description: |
Packages (comma-separated) or 'ALL' to select all available recipes:
required: false
default: "pydantic-core:,numpy:,pillow:"
default: "lru-dict:,pydantic-core:,numpy:"
prebuild_recipes:
description: |
Recipes (comma-separated; typically flet-lib*) to build FIRST and seed into
Expand Down Expand Up @@ -454,6 +454,7 @@ jobs:
env:
PKG_NAME: ${{ steps.detect-tests.outputs.pkg_name }}
PKG_VERSION: ${{ steps.detect-tests.outputs.pkg_version }}
INPUT_PYTHON_VERSION: ${{ inputs.python_version }}
run: |
set -euxo pipefail

Expand All @@ -479,7 +480,7 @@ jobs:
./tests/recipe-tester/stage_recipe.sh "$PKG_NAME" "$PKG_VERSION"
cd tests/recipe-tester
PIP_FIND_LINKS="$GITHUB_WORKSPACE/dist-test" \
uvx --with flet-cli flet build apk --arch x86_64 -vv --yes
uvx --prerelease allow --with 'flet-cli>=0.86.0.dev0' --with 'flet>=0.86.0.dev0' flet build apk -vv --yes --python-version "$(echo "$INPUT_PYTHON_VERSION" | cut -d. -f1-2)"

- name: Test on Android emulator (API 28, x86_64)
if: matrix.platform == 'android' && steps.detect-tests.outputs.has_tests == 'true'
Expand All @@ -501,6 +502,7 @@ jobs:
env:
PKG_NAME: ${{ steps.detect-tests.outputs.pkg_name }}
PKG_VERSION: ${{ steps.detect-tests.outputs.pkg_version }}
INPUT_PYTHON_VERSION: ${{ inputs.python_version }}
run: |
set -euxo pipefail

Expand All @@ -519,7 +521,7 @@ jobs:
./tests/recipe-tester/stage_recipe.sh "$PKG_NAME" "$PKG_VERSION"
cd tests/recipe-tester
PIP_FIND_LINKS="$GITHUB_WORKSPACE/dist-test" \
uvx --with flet-cli flet build ios-simulator -v --yes
uvx --prerelease allow --with 'flet-cli>=0.86.0.dev0' --with 'flet>=0.86.0.dev0' flet build ios-simulator -vv --yes --python-version "$(echo "$INPUT_PYTHON_VERSION" | cut -d. -f1-2)"

- name: Test on iOS Simulator
if: matrix.platform == 'ios' && steps.detect-tests.outputs.has_tests == 'true'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ on:
packages:
type: string
required: false
default: "pydantic-core:,numpy:,pillow:"
default: "lru-dict:,pydantic-core:,numpy:"
prebuild_recipes:
type: string
required: false
Expand Down Expand Up @@ -81,7 +81,7 @@ env:
# Used as the fallback recipe set when `packages` input is empty
# (workflow_dispatch/workflow_call) or when no `recipes/**` paths
# changed in the triggering event (push/pull_request).
SMOKE_TEST_PACKAGES: "pydantic-core:,numpy:,pillow:"
SMOKE_TEST_PACKAGES: "lru-dict:,pydantic-core:,numpy:"

permissions:
contents: read
Expand Down
13 changes: 11 additions & 2 deletions tests/recipe-tester/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,28 @@ def _run_pytest() -> None:
until the next loop iteration.
"""
global EXIT_CODE, DONE
import os
import pytest

# Anchor the tests dir to THIS module's location, not the cwd. Flet 0.86's
# iOS packaging runs the app with cwd = <container>/Library/Application
# Support/data, while `recipe_tests/` is bundled next to this file — so a
# relative "recipe_tests" resolves against the wrong dir and pytest reports
# "directory not found" (EXIT 4). An absolute __file__-relative path is
# correct on every platform / Flet version.
tests_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "recipe_tests")

EXIT_CODE = pytest.main(
[
"-v",
"--rootdir",
"recipe_tests", # don't walk the bundled stdlib zip looking for conftest.py
tests_dir, # don't walk the bundled stdlib zip looking for conftest.py
"-p",
"no:cacheprovider", # don't try to write .pytest_cache/ on a potentially read-only mobile FS
"--capture=no", # let test prints reach console.log too (default pytest capture hides stdout)
"--no-header",
"--tb=short", # compact output for console.log
"recipe_tests/",
tests_dir,
]
)

Expand Down
11 changes: 9 additions & 2 deletions tests/recipe-tester/pyproject.toml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description = "Generic in-app pytest runner for mobile-forge recipe wheels."
requires-python = ">=3.10"

dependencies = [
"flet",
"flet>=0.86.0.dev0",
"pytest",
# `stage_recipe.sh` rewrites the line below to pin the recipe under test (e.g. `"numpy==2.2.2"`),
# and replaces the token line after it with any test-only deps declared in
Expand All @@ -16,11 +16,18 @@ dependencies = [

[dependency-groups]
dev = [
"flet[all]",
"flet[all]>=0.86.0.dev0",
]

[tool.flet]
artifact = "recipe-tester"

# Flet >=0.86 compiles the app to .pyc and strips the source by default, but pytest
# only collects .py test files — so the bundled recipe_tests would report "0 items"
# (EXIT 5). Keep the app source (main.py + recipe_tests/*.py) as .py. This only
# affects the app; bundled/package dependencies still get compiled.
[tool.flet.compile]
app = false

[tool.flet.app]
path = "."
Loading