Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,24 @@ All notable changes to python-libei are recorded here. The format follows
[semantic versioning](https://semver.org/spec/v2.0.0.html) — with the usual
0.x caveat that the API may still change between minor versions.

## [Unreleased]

### Fixed

- **The test suite ran nothing at all off Linux and FreeBSD.** `tests/test_loader.py`
raised at module level when `ctypes.util.find_library("c")` found no C library,
which pytest reports as a *collection* error -- so on Windows `pytest -q -rs`
stopped before any of the other 200-odd tests, including every pure-Python one.
The four loader tests that need a real library now skip there instead, and the
three tests that build a keymap with `os.memfd_create` skip where it does not
exist. On Windows the suite now reports 212 passed, 18 skipped; on Linux nothing
changes -- 230 passed against libei 1.6.0.
- **The count of unbound gesture/stylus functions was stale.** The README and
`docs/developers/architecture.md` said libei's `main` adds 22; counted against
1.6.0's headers on 2026-09-30 it is 46 in libei and 51 in libeis, now that the
stylus protocol has landed there too. Still none of it is in a release, so still
none of it is bound.

## [0.6.0] - 2026-09-22

### Added
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ because a skimming reader could otherwise take them as supported. 1.6.0's own
`enum ei_device_capability` stops at `TEXT`, and its `enum ei_event_type`
stops at `EI_EVENT_TEXT_UTF8` — so the swipe/pinch/hold/stylus members of
`EventType` cannot arrive either. The values here match upstream `main`
exactly, so they are ready for whatever release adds them. The 22
gesture/stylus accessor functions `main` adds are deliberately not bound:
exactly, so they are ready for whatever release adds them. The gesture
and stylus functions `main` adds -- 46 in libei and 51 in libeis against
1.6.0's headers, counted 2026-09-30 -- are deliberately not bound:
nothing that ships today exports them, so nothing here could be verified
against a real library, which is the bar every other binding in this package
was held to.
Expand Down
6 changes: 4 additions & 2 deletions docs/developers/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ deliberate:
is only ever created by its own `create_for_*()`, never wrapped from a raw
pointer.

The 22 gesture/stylus accessor functions that libei's `main` branch adds are
also unbound. Nothing that ships today exports them, so nothing here could be
The gesture and stylus functions that libei's `main` branch adds -- 46 in
libei and 51 in libeis against 1.6.0's headers, counted 2026-09-30: the
swipe, pinch and hold senders and event getters, and the whole stylus
protocol -- are also unbound. Nothing that ships today exports them, so nothing here could be
verified against a real library — which is the bar every other binding in this
package was held to.

Expand Down
4 changes: 4 additions & 0 deletions tests/test_ei_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,10 @@ def test_peek_event_type_is_none_on_an_empty_queue(
assert ctx.peek_event_type() is None


@pytest.mark.skipif(
not hasattr(os, "memfd_create"),
reason="os.memfd_create is Linux/FreeBSD only",
)
def test_keymap_fd_is_rewound(monkeypatch: pytest.MonkeyPatch) -> None:
# dup(2) shares the file offset, and libei leaves its own fd at EOF --
# without a rewind the caller reads zero bytes and no error, which looks
Expand Down
4 changes: 4 additions & 0 deletions tests/test_eis_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,10 @@ def test_region_mapping_id_round_trips(monkeypatch: pytest.MonkeyPatch) -> None:
assert region.mapping_id == "screen-0"


@pytest.mark.skipif(
not hasattr(os, "memfd_create"),
reason="os.memfd_create is Linux/FreeBSD only",
)
def test_keymap_fd_is_rewound(monkeypatch: pytest.MonkeyPatch) -> None:
fd = os.memfd_create("keymap")
try:
Expand Down
4 changes: 4 additions & 0 deletions tests/test_integration_extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ def on_client_event(event: ei.Event) -> None:
assert pongs[0] == sent_id[0]


@pytest.mark.skipif(
not hasattr(os, "memfd_create"),
reason="os.memfd_create is Linux/FreeBSD only",
)
def test_keymap_transfers_and_reads_back() -> None:
keymap_text = b"xkb_keymap { /* test */ };\x00"
source = os.memfd_create("test-keymap")
Expand Down
15 changes: 12 additions & 3 deletions tests/test_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@
from libei._capi.loader import LazyLibrary, LibraryNotFoundError

_found_libc = util.find_library("c")
if _found_libc is None:
raise RuntimeError("no C library found -- these tests need one to stand in")
_LIBC: str = _found_libc
_LIBC: str = _found_libc or ""
# A skip, not a module-level raise: raising here was a *collection* error, so
# on a machine with no findable C library (Windows) pytest ran none of the
# suite's other tests either. Only the tests that load a real library need
# one; the loader-defers tests below run everywhere.
_needs_libc = pytest.mark.skipif(
_found_libc is None, reason="needs a real C library as a stand-in (POSIX only)"
)


def test_import_does_not_touch_the_filesystem() -> None:
Expand All @@ -43,11 +48,13 @@ def test_missing_library_is_not_available() -> None:
assert lib.is_available() is False


@_needs_libc
def test_real_library_is_available() -> None:
lib = LazyLibrary(_LIBC)
assert lib.is_available() is True


@_needs_libc
def test_real_function_call_round_trips() -> None:
lib = LazyLibrary(_LIBC)
abs_ = lib.function("abs", (c_int,), c_int)
Expand All @@ -67,13 +74,15 @@ def test_function_result_is_cached_across_calls() -> None:
abs_(-1)


@_needs_libc
def test_missing_symbol_raises_library_not_found_error() -> None:
lib = LazyLibrary(_LIBC)
nonexistent = lib.function("this_symbol_does_not_exist_in_libc", (c_char_p,), c_int)
with pytest.raises(LibraryNotFoundError, match="does not export"):
nonexistent(b"x")


@_needs_libc
def test_two_lazy_libraries_are_independent() -> None:
good = LazyLibrary(_LIBC)
bad = LazyLibrary("this-library-definitely-does-not-exist.so.999")
Expand Down
Loading