MCPcopy
hub / github.com/pyinstaller/pyinstaller / test_appimage_loading

Function test_appimage_loading

tests/functional/test_linux_appimage.py:25–54  ·  view source on GitHub ↗
(tmp_path, pyi_builder_spec, arch)

Source from the content-addressed store, hash-verified

23@pytest.mark.linux
24@pytest.mark.parametrize('arch', ['x86_64'])
25def 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])

Callers

nothing calls this directly

Calls 3

skipMethod · 0.80
chmodMethod · 0.80
test_sourceMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…