(tmp_path, pyi_builder_spec, arch)
| 23 | @pytest.mark.linux |
| 24 | @pytest.mark.parametrize('arch', ['x86_64']) |
| 25 | def test_appimage_loading(tmp_path, pyi_builder_spec, arch): |
| 26 | # Skip the test if appimagetool is not found |
| 27 | appimagetool = pathlib.Path.home() / f'appimagetool-{arch}.AppImage' |
| 28 | if not appimagetool.is_file(): |
| 29 | pytest.skip(f'{str(appimagetool)!r} not found') |
| 30 | |
| 31 | # Ensure appimagetool is executable |
| 32 | if not os.access(appimagetool, os.X_OK): |
| 33 | st = appimagetool.stat() |
| 34 | appimagetool.chmod(st.st_mode | stat.S_IXUSR) |
| 35 | |
| 36 | app_name = 'apptest' |
| 37 | app_path = tmp_path / f'{app_name}-{arch}.AppImage' |
| 38 | |
| 39 | # Freeze the app |
| 40 | pyi_builder_spec.test_source('print("OK")', app_name=app_name, pyi_args=["--onedir"]) |
| 41 | |
| 42 | # Prepare the dist folder for AppImage compliance |
| 43 | tools_dir = pathlib.Path(__file__).parent / 'data' / 'appimage' |
| 44 | script = tools_dir / 'create.sh' |
| 45 | subprocess.check_call(['bash', script, tools_dir, tmp_path, app_name]) |
| 46 | |
| 47 | # Create the AppImage |
| 48 | app_dir = tmp_path / 'dist' / 'AppRun' |
| 49 | subprocess.check_call([appimagetool, "--no-appstream", app_dir, app_path]) |
| 50 | |
| 51 | # Launch the AppImage |
| 52 | st = app_path.stat() |
| 53 | app_path.chmod(st.st_mode | stat.S_IXUSR) |
| 54 | subprocess.check_call([app_path]) |
nothing calls this directly
no test coverage detected
searching dependent graphs…