pmbootstrap init: only display UIs for device arch (MR 1937)

Hide user interfaces that are not available for the selected device's
architecture.

Closes #1790
This commit is contained in:
Anjandev Momi 2020-05-14 03:20:11 -07:00 committed by Oliver Smith
parent 2d2ab1df56
commit 0ff9c5d471
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
6 changed files with 55 additions and 7 deletions

32
test/test_helpers_ui.py Normal file
View file

@ -0,0 +1,32 @@
# Copyright 2020 Oliver Smith
# SPDX-License-Identifier: GPL-3.0-or-later
import pytest
import sys
import pmb_test
import pmb_test.const
import pmb.helpers.logging
import pmb.helpers.ui
@pytest.fixture
def args(tmpdir, request):
import pmb.parse
cfg = f"{pmb_test.const.testdata}/channels.cfg"
sys.argv = ["pmbootstrap.py", "--config-channels", cfg, "init"]
args = pmb.parse.arguments()
args.log = args.work + "/log_testsuite.txt"
pmb.helpers.logging.init(args)
request.addfinalizer(args.logfd.close)
return args
def test_helpers_ui(args):
""" Test the UIs returned by pmb.helpers.ui.list() with a testdata pmaports
dir. That test dir has a plasma-mobile UI, which is disabled for armhf,
so it must not be returned when querying the UI list for armhf. """
args.aports = f"{pmb_test.const.testdata}/helpers_ui/pmaports"
func = pmb.helpers.ui.list
assert func(args, "armhf") == [("none", "No graphical environment")]
assert func(args, "x86_64") == [("none", "No graphical environment"),
("plasma-mobile", "cool pkgdesc")]