async def test_examples(native_app, path): example = path[:-6].replace("/", ".") # Remove example/ and .enaml if "thermostat" in example: return pytest.skip("thermostat example needs updated") app = AndroidApplication(debug=True) with enaml.imports(): try: ContentView = locate(f"{example}.ContentView") except ErrorDuringImport as e: msg = f"{e}" if iconify is None and "iconify" in msg: return pytest.skip("enaml-native-icons is not installed") if googlemaps is None and "googlemaps" in msg: return pytest.skip("enaml-native-maps is not installed") if charts is None and "charts" in msg: return pytest.skip("enaml-native-charts is not installed") raise app.activity = ExampleActivity(example=ContentView()) f = nativehooks.shown = app.create_future() def on_error(event): f.set_exception(event["value"]) app.observe("error_occurred", on_error) # f.add_done_callback(lambda f: app.stop()) # Add fail timeout app.timed_call(5 * 1000, lambda: f.set_result(False)) app.deferred_call(app.activity.start) assert await f
def test_playground_app(enamlnative_app): app = AndroidApplication(debug=True) with open("examples/playground/view.enaml") as f: ContentView = load(f.read()) app.activity = ExampleActivity(example=ContentView()) app.run()