Skip to content

Commit 0af4bd7

Browse files
committed
fix(testing): name the test binary after project_name (Windows/Linux desktop)
Windows and Linux `flet test` failed after a successful build with `Unable to start executable ... Failed to find "<project_name>.exe/binary"`. Root cause (the "doesn't build on desktop" hypothesis was wrong — Flutter does build): the Windows/Linux runner sets the executable OUTPUT_NAME to `artifact_name`, but `flutter test -d <desktop>` launches the binary by the Flutter pubspec `name` (== project_name). When `[tool.flet] artifact` differs from the project name (e.g. `flet-test-counter` vs `flet_test_counter`), the built binary and the launched path don't match. macOS is unaffected (its `.app` is located by the product/artifact name). In test mode, pin `artifact_name = project_name` so the desktop binary's name matches what the integration-test host launches. Verified: macOS still passes (now builds `flet_test_counter.app`); fixes the Windows/Linux launch path.
1 parent d143d17 commit 0af4bd7

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

sdk/python/packages/flet-cli/src/flet_cli/commands/build_base.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,13 @@ def setup_template_data(self):
893893
or self.get_pyproject("project.name")
894894
or self.python_app_path.name
895895
)
896+
# Under integration test, `flutter test -d <desktop>` launches the built
897+
# binary by the project name (the Flutter pubspec `name`), but the
898+
# Windows/Linux runner sets the executable's OUTPUT_NAME to artifact_name.
899+
# When they differ (e.g. `artifact = "my-app"` vs project `my_app`) the
900+
# test host can't find the binary. Pin them equal in test mode.
901+
if getattr(self, "test_mode", False):
902+
artifact_name = project_name
896903
product_name = (
897904
self.options.product_name
898905
or self.get_pyproject("tool.flet.product")

0 commit comments

Comments
 (0)