tests.test_gnome_extension module¶
Static invariants of the GNOME Shell extension.
The extension is GJS code the Python suite cannot import, so these tests pin the
contracts that keep its moving parts in sync: the metadata.json identity, the
GSettings schema, the stylesheet classes, the icon set and the argv builders.
The behavioral coverage lives in tests/gnome/run-tests.js, executed under a
bare gjs interpreter by test_gjs_unit_suite() when one is installed.
No CI runner running pytest installs gjs, so that wrapper is a convenience for
a developer who has one: in CI the same script is driven directly by the gjs
job of the tests-gnome-extension.yaml workflow.
- tests.test_gnome_extension.pytestmark = MarkDecorator(mark=Mark(name='once', args=(), kwargs={}))¶
These assert on checked-in extension sources, not on the host: the
once-testsjob runs them on a single runner instead of every matrix cell.
- tests.test_gnome_extension.EXPECTED_ICON_STATES = frozenset({'checking', 'error', 'unknown', 'updates', 'uptodate'})¶
Values of the
Statemapping inextension.js, each mapped bySTATE_ICONSto a stock symbolic icon name.
- tests.test_gnome_extension.PACK_DEFAULTS = frozenset({'extension.js', 'metadata.json', 'prefs.js', 'schemas', 'stylesheet.css'})¶
Sources
gnome-extensions packbundles on its own.extension.jsandmetadata.jsonare mandatory,prefs.jsand the stylesheets optional, and aschemas/folder is picked up automatically. Anything else needs an explicit--extra-source, without which it silently never reaches the zip. Documentation: gnome-extensions(1) man page.
- tests.test_gnome_extension.PACKING_WORKFLOWS = ('release.yaml', 'tests-gnome-extension.yaml')¶
Both workflows packing the extension: one produces the release asset, the other the artifact round-tripped through
gnome-extensions install.
The detached report section must define
_setOpenedSubMenu.A narrow guard, keyed on the one line that stops a specific shell crash rather than the whole class: the grouped layout adds
PopupSubMenuMenuItem``s to ``_reportSection, whose actor is embedded in the ScrollView instead of added to the menu, so the section is its own top menu. A submenu open or close then calls_setOpenedSubMenuon it, which a barePopupMenuSectionlacks, throwing inside a signal handler and crashing gnome-shell on the nextremoveAll. Reported upstream as GNOME/gnome-shell#9424. Cannot run in the gjs suite, which never loads a shell.
- tests.test_gnome_extension.test_settings_keys_in_sync()[source]¶
Every key read in the JS sources exists in the schema, and vice versa.
Guards against the drift arch-update ships with, where code defaults disagree with schema defaults or keys outlive their last reader.
- tests.test_gnome_extension.test_css_classes_in_sync()[source]¶
Every
.mpm-*class referenced in JS is styled, and vice versa.
- tests.test_gnome_extension.test_icon_states_in_sync()[source]¶
The
Statemapping values match the bundled symbolic icon set.
- tests.test_gnome_extension.test_state_maps_to_a_themed_icon(state)[source]¶
Every panel state names a stock icon instead of bundled artwork.
The shell resolves these against the user’s icon theme, which is what lets it recolor them with the panel foreground and lets a theme (Yaru on Ubuntu) restyle them. The
-symbolicsuffix is what marks a name as themable.
- tests.test_gnome_extension.test_no_orphan_icons()[source]¶
The logo is the only artwork left, and the preferences window uses it.
- tests.test_gnome_extension.test_logo_matches_the_brand_mark()[source]¶
The extension ships the brand mark itself, not a fork of it.
docs/brand_update.pyowns every artwork underdocs/assets/, but not this copy: the extension bundles its own icons, and the flat redesign had to be carried over by hand. Byte-identity turns the next such drift into a failure.
- tests.test_gnome_extension.test_install_bootstrap_matches_the_bar_plugin()[source]¶
Both frontends offer the same command to install a missing
mpm.The two menus are written in different languages against different toolkits, so nothing else holds their bootstrap offer together.
- tests.test_gnome_extension.test_pack_whitelists_are_identical()[source]¶
Both packing workflows declare the same sources.
They pack the same artifact: the tested zip stops being the shipped one the moment their whitelists diverge.
- tests.test_gnome_extension.test_pack_whitelist_covers_every_source()[source]¶
Every file of the extension directory reaches the packed zip.
gnome-extensions packpacks from a whitelist, so a file added here but declared nowhere is dropped from the bundle without a word, and a declared file that was since removed breaks the pack. Both fail here instead.
- tests.test_gnome_extension.test_bundled_license_matches_the_project()[source]¶
The extension carries its own copy of the license.
The zip is distributed detached from the repository, on GitHub releases and extensions.gnome.org alike, and GNOME Shell extensions are derived works of a
GPL-2.0-or-latercodebase: the license text has to travel with it.
- tests.test_gnome_extension.test_shell_env_gate_matches_the_bar_plugin()[source]¶
Both frontends pass
--shell-envfrom the samempmrelease on.An older
mpmrejects the option as unknown, so the gate is what keeps a distribution’smpmworking under a newer frontend.
- tests.test_gnome_extension.test_runtime_argv_long_form()[source]¶
The argv builders only emit long-form options.
Same rule as for every argv
mpmitself constructs at runtime (see the manager classes andmeta_package_manager/sudo.py). The only tolerated short form issh -c, which POSIX defines with no long equivalent.
- tests.test_gnome_extension.test_extension_js_shell_free_module()[source]¶
mpm.jsnever imports shell modules, so it stays testable under gjs.
- tests.test_gnome_extension.test_process_import_boundaries()[source]¶
The two-process import rules of the extensions.gnome.org guidelines.
The shell process must never load GTK libraries, and the preferences process must never load shell libraries.
- tests.test_gnome_extension.test_capture_driver_targets_this_extension()[source]¶
The screenshot driver carries its own copy of the extension identity.
- tests.test_gnome_extension.test_capture_settings_exist_in_the_schema()[source]¶
Every extension setting the capture writes is declared in the schema.
A renamed key would otherwise surface as a
gsettings setfailure minutes into a headless GNOME session, on a runner, instead of here.
- tests.test_gnome_extension.test_captures_are_referenced_by_the_docs()[source]¶
Each capture is shown on the extension’s page, and none is an orphan.
The images are written by a workflow and read by a page neither of which can see the other: a renamed shot leaves a broken image on the site and a stale file in the asset folder, and nothing else reports either.