Skip to content

test failure when kalamine is built using lxml 5.4.0 and libxml2 2.14.3 #214

@doko42

Description

@doko42

we see a test failure when MechanicalSoup is built using lxml 5.4.0 and libxml2 2.14.3, as in
https://autopkgtest.ubuntu.com/packages/k/kalamine/questing/amd64
The test passes whith an older libxml2 2.9.14.

 80s =================================== FAILURES ===================================
 80s _______________________________ test_keylayouts ________________________________
 80s 
 80s     def test_keylayouts():
 80s >       check_keylayout("q-ansi")
 80s 
 80s tests/test_macos.py:82: 
 80s _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
 80s 
 80s filename = 'q-ansi'
 80s 
 80s     def check_keylayout(filename: str):
 80s         path = Path(__file__).parent.parent / f"dist/{filename}.keylayout"
 80s         tree = etree.parse(path, etree.XMLParser(recover=True))
 80s         dead_keys = []
 80s     
 80s         # check all keymaps/layers: base, shift, caps, option, option+shift
 80s         for keymap_index in range(5):
 80s             keymap_query = f'//keyMap[@index="{keymap_index}"]'
 80s             keymap = tree.xpath(keymap_query)
 80s             assert len(keymap) == 1, f"{keymap_query} should be unique"
 80s     
 80s             # check all key codes for this keymap / layer
 80s             # (the key codes below are not used, I don't know why)
 80s             excluded_keys = [
 80s                 54,
 80s                 55,
 80s                 56,
 80s                 57,
 80s                 58,
 80s                 59,
 80s                 60,
 80s                 61,
 80s                 62,
 80s                 63,
 80s                 68,
 80s                 73,
 80s                 74,
 80s                 90,
 80s                 93,
 80s                 94,
 80s                 95,
 80s             ]
 80s             for key_index in range(126):
 80s                 if key_index in excluded_keys:
 80s                     continue
 80s     
 80s                 # ensure the key is defined and unique
 80s                 key_query = f'{keymap_query}/key[@code="{key_index}"]'
 80s                 key = tree.xpath(key_query)
 80s                 assert len(key) == 1, f"{key_query} should be unique"
 80s     
 80s                 # ensure the key has either a direct output or a valid action
 80s                 action_id = key[0].get("action")
 80s                 if action_id:
 80s                     if action_id.startswith("dead_"):
 80s                         dead_keys.append(action_id[5:])
 80s                     action_query = f'//actions/action[@id="{action_id}"]'
 80s                     action = tree.xpath(action_query)
 80s                     assert len(action) == 1, f"{action_query} should be unique"
 80s                     assert (
 80s                         len(action_id) > 1
 80s                     ), f"{key_query} should have a multi-char action ID"
 80s                 else:
 80s                     assert (
 80s >                       len(key[0].get("output")) <= 1
 80s                     ), f"{key_query} should have a one-char output"
 80s E                   TypeError: object of type 'NoneType' has no len()
 80s 
 80s tests/test_macos.py:60: TypeError
 80s =========================== short test summary info ============================
 80s FAILED tests/test_macos.py::test_keylayouts - TypeError: object of type 'None...
 80s ========================= 1 failed, 18 passed in 0.29s =========================

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions