Skip to content

TestSortContacts.test_sorting_of_korean_names fails on Darwin #354

@doronbehar

Description

@doronbehar

In addition to #353 , we experience the following test failure on NixOS on both the aarch64-darwin and x86_64-darwin platforms:

=================================== FAILURES ===================================
________________ TestSortContacts.test_sorting_of_korean_names _________________

self = <test.test_khard.TestSortContacts testMethod=test_sorting_of_korean_names>

    def test_sorting_of_korean_names(self):
        korean_c = load_contact("korean-c.vcf")
        korean_j = load_contact("korean-j.vcf")
        with mock_locale(locale.LC_COLLATE, "korean"):
>           self._test(korean_j, korean_c)

test/test_khard.py:233: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
test/test_khard.py:220: in _test
    actual = khard.sort_contacts(order, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
khard/khard.py:311: in sort_contacts
    return sorted(contacts, reverse=reverse,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

x = <khard.contacts.Contact object at 0x1068dcde0>

>   key=lambda x: [locale.strxfrm(key(x).lower())
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                   for key in keys])
E                  OSError: [Errno 22] Invalid argument

khard/khard.py:312: OSError
=============================== warnings summary ===============================
test/test_address_book.py: 2 warnings
test/test_command_line_interface.py: 6 warnings
test/test_helpers_typing.py: 12 warnings
test/test_khard.py: 2 warnings
test/test_vcard_wrapper.py: 4 warnings
test/test_yaml.py: 14 warnings
  /nix/var/nix/builds/nix-99977-667330482/source/khard/helpers/typing.py:76: DeprecationWarning: Parsing dates involving a day of month without a year specified is ambiguious
  and fails to parse leap day. The default behavior will change in Python 3.15
  to either always raise an exception or to use a different default year (TBD).
  To avoid trouble, add a specific year to the input & format.
  See https://github.com/python/cpython/issues/70647.
    return datetime.strptime(string, fmt)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED test/test_khard.py::TestSortContacts::test_sorting_of_korean_names - OSError: [Errno 22] Invalid argument
===== 1 failed, 395 passed, 2 deselected, 1 xfailed, 40 warnings in 0.61s ======

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions