Skip to content

Commit

Permalink
feat: add evdev test to linux
Browse files Browse the repository at this point in the history
  • Loading branch information
oxidase committed Dec 25, 2024
1 parent d517939 commit 3bc704d
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 49 deletions.
9 changes: 9 additions & 0 deletions examples/cc_toolchain/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
load("@ofiuco//python:poetry.bzl", "poetry_update")

py_test(
name = "test",
size = "large",
srcs = ["test.py"],
data = ["poetry.lock"],
deps = [
"@poetry//:evdev",
"@poetry//:llama-cpp-python",
"@poetry//:pytest",
],
)

poetry_update(
name = "update_lock",
lock = "poetry.lock",
toml = "pyproject.toml",
)
108 changes: 59 additions & 49 deletions examples/cc_toolchain/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/cc_toolchain/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ authors = []
[tool.poetry.dependencies]
python = "^3.11"
llama_cpp_python = "^0.2"
evdev = "^1.7.1"

[tool.poetry.group.dev.dependencies]
pytest = {version = "^7.2", "python" = ">=3.7"}
9 changes: 9 additions & 0 deletions examples/cc_toolchain/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import pytest

import evdev
import llama_cpp
from llama_cpp.llama_cpp import _lib as llama_lib
from llama_cpp.llama_cpp import _lib_base_name as lib_base_name
Expand All @@ -25,5 +26,13 @@ def test_llama_library_rpath():
assert b"bazel-out/" in handle.read()


def test_evdev():
devices = [evdev.InputDevice(path) for path in evdev.list_devices()]
for device in devices:
print(device.path, device.name, device.phys)

assert len(evdev.list_devices()) > 0


if __name__ == "__main__":
sys.exit(pytest.main(sys.argv))

0 comments on commit 3bc704d

Please sign in to comment.