MCPcopy
hub / github.com/flet-dev/flet / start

Method start

sdk/python/packages/flet/src/flet/testing/flet_test_app.py:189–283  ·  view source on GitHub ↗

Starts Flet app and Flutter integration test process.

(self)

Source from the content-addressed store, hash-verified

187 return self.__tester
188
189 async def start(self):
190 """
191 Starts Flet app and Flutter integration test process.
192 """
193
194 ready = asyncio.Event()
195
196 async def main(page: ft.Page):
197 """
198 Initializes the test page and runs the user-provided Flet app entry point.
199
200 Args:
201 page: Connected app :class:`~flet.Page` instance.
202 """
203 self.__page = page
204 self.__tester = Tester()
205 page.theme_mode = ft.ThemeMode.LIGHT
206 page.update()
207
208 if inspect.iscoroutinefunction(self.__flet_app_main):
209 await self.__flet_app_main(page)
210 elif callable(self.__flet_app_main):
211 self.__flet_app_main(page)
212 if not self.__skip_pump_and_settle:
213 await self.__pump_and_settle_with_timeout("start")
214 ready.set()
215
216 if not self.__tcp_port:
217 self.__tcp_port = get_free_tcp_port()
218
219 if self.__use_http:
220 os.environ["FLET_FORCE_WEB_SERVER"] = "true"
221
222 asyncio.create_task(
223 ft.run_async(
224 main, port=self.__tcp_port, assets_dir=str(self.__assets_dir), view=None
225 )
226 )
227 print("Started Flet app")
228
229 stdout = asyncio.subprocess.DEVNULL
230 stderr = asyncio.subprocess.DEVNULL
231 if logging.getLogger().getEffectiveLevel() == logging.DEBUG:
232 stdout = None
233 stderr = None
234
235 flutter_args = ["fvm", "flutter", "test", "integration_test"]
236
237 if self.__disable_fvm:
238 flutter_args.pop(0)
239
240 if self.test_platform is None:
241 self.test_platform = {
242 "Windows": "windows",
243 "Linux": "linux",
244 "Darwin": "macos",
245 }.get(platform.system(), "unknown")
246

Callers

nothing calls this directly

Calls 4

get_free_tcp_portFunction · 0.90
PathClass · 0.85
popMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected