Open kloczek opened 3 years ago
After fixing issue with importing module I have fails because no write permission to /dev/uinput. Do I have wrong perm on that device file?
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-evdev-1.4.0-2.1.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-evdev-1.4.0-2.1.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.11, pytest-6.2.5, py-1.10.0, pluggy-0.13.1
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
Using --randomly-seed=1338524622
rootdir: /home/tkloczko/rpmbuild/BUILD/python-evdev-1.4.0
plugins: forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, freezegun-0.4.2, aspectlib-1.5.2, toolbox-0.5, rerunfailures-9.1.1, requests-mock-1.9.3, cov-2.12.1, flaky-3.7.0, benchmark-3.4.1, xdist-2.3.0, pylama-7.7.1, datadir-1.3.1, regressions-2.2.0, cases-3.6.3, xprocess-0.18.1, black-0.3.12, anyio-3.3.0, asyncio-0.15.1, trio-0.7.0, subtests-0.5.0, isort-2.0.0, hypothesis-6.14.6, mock-3.6.1, profiling-1.7.0, randomly-3.8.0, Faker-8.12.1, nose2pytest-1.0.8, pyfakefs-4.5.1, tornado-0.8.1
collected 12 items
tests/test_ecodes.py ... [ 25%]
tests/test_uinput.py FFF.FF [ 75%]
tests/test_util.py . [ 83%]
tests/test_events.py .. [100%]
================================================================================= FAILURES =================================================================================
_____________________________________________________________________________ test_abs_values ______________________________________________________________________________
c = {'bustype': 3, 'events': {1: [30, 48], 3: [(0, (0, 255, 0, 0)), (1, AbsInfo(value=0, min=255, max=5, fuzz=10, flat=0, resolution=0))]}, 'name': 'test-py-evdev-uinput', 'product': 8704, ...}
def test_abs_values(c):
e = ecodes
c['events'] = {
e.EV_KEY: [e.KEY_A, e.KEY_B],
e.EV_ABS: [(e.ABS_X, (0, 255, 0, 0)),
(e.ABS_Y, device.AbsInfo(0, 255, 5, 10, 0, 0))],
}
> with uinput.UInput(**c) as ui:
tests/test_uinput.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../BUILDROOT/python-evdev-1.4.0-2.1.fc35.x86_64/usr/lib64/python3.8/site-packages/evdev/uinput.py:127: in __init__
self._verify()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = UInput('test-py-evdev-uinput', 3, 4352, 8704, 13056, 'py-evdev-uinput')
def _verify(self):
'''
Verify that an uinput device exists and is readable and writable
by the current process.
'''
try:
m = os.stat(self.devnode)[stat.ST_MODE]
if not stat.S_ISCHR(m):
raise
except (IndexError, OSError):
msg = '"{}" does not exist or is not a character device file '\
'- verify that the uinput module is loaded'
raise UInputError(msg.format(self.devnode))
if not os.access(self.devnode, os.W_OK):
msg = '"{}" cannot be opened for writing'
> raise UInputError(msg.format(self.devnode))
E evdev.uinput.UInputError: "/dev/uinput" cannot be opened for writing
../../BUILDROOT/python-evdev-1.4.0-2.1.fc35.x86_64/usr/lib64/python3.8/site-packages/evdev/uinput.py:274: UInputError
________________________________________________________________________________ test_write ________________________________________________________________________________
c = {'bustype': 3, 'name': 'test-py-evdev-uinput', 'product': 8704, 'vendor': 4352, ...}
def test_write(c):
> with uinput.UInput(**c) as ui:
tests/test_uinput.py:84:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../BUILDROOT/python-evdev-1.4.0-2.1.fc35.x86_64/usr/lib64/python3.8/site-packages/evdev/uinput.py:127: in __init__
self._verify()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = UInput('test-py-evdev-uinput', 3, 4352, 8704, 13056, 'py-evdev-uinput')
def _verify(self):
'''
Verify that an uinput device exists and is readable and writable
by the current process.
'''
try:
m = os.stat(self.devnode)[stat.ST_MODE]
if not stat.S_ISCHR(m):
raise
except (IndexError, OSError):
msg = '"{}" does not exist or is not a character device file '\
'- verify that the uinput module is loaded'
raise UInputError(msg.format(self.devnode))
if not os.access(self.devnode, os.W_OK):
msg = '"{}" cannot be opened for writing'
> raise UInputError(msg.format(self.devnode))
E evdev.uinput.UInputError: "/dev/uinput" cannot be opened for writing
../../BUILDROOT/python-evdev-1.4.0-2.1.fc35.x86_64/usr/lib64/python3.8/site-packages/evdev/uinput.py:274: UInputError
________________________________________________________________________________ test_open _________________________________________________________________________________
c = {'bustype': 3, 'name': 'test-py-evdev-uinput', 'product': 8704, 'vendor': 4352, ...}
def test_open(c):
> ui = uinput.UInput(**c)
tests/test_uinput.py:34:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../BUILDROOT/python-evdev-1.4.0-2.1.fc35.x86_64/usr/lib64/python3.8/site-packages/evdev/uinput.py:127: in __init__
self._verify()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = UInput('test-py-evdev-uinput', 3, 4352, 8704, 13056, 'py-evdev-uinput')
def _verify(self):
'''
Verify that an uinput device exists and is readable and writable
by the current process.
'''
try:
m = os.stat(self.devnode)[stat.ST_MODE]
if not stat.S_ISCHR(m):
raise
except (IndexError, OSError):
msg = '"{}" does not exist or is not a character device file '\
'- verify that the uinput module is loaded'
raise UInputError(msg.format(self.devnode))
if not os.access(self.devnode, os.W_OK):
msg = '"{}" cannot be opened for writing'
> raise UInputError(msg.format(self.devnode))
E evdev.uinput.UInputError: "/dev/uinput" cannot be opened for writing
../../BUILDROOT/python-evdev-1.4.0-2.1.fc35.x86_64/usr/lib64/python3.8/site-packages/evdev/uinput.py:274: UInputError
____________________________________________________________________________ test_open_context _____________________________________________________________________________
c = {'bustype': 3, 'name': 'test-py-evdev-uinput', 'product': 8704, 'vendor': 4352, ...}
def test_open_context(c):
args = (c['bustype'], c['vendor'], c['product'], c['version'])
> with uinput.UInput(**c):
tests/test_uinput.py:42:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../BUILDROOT/python-evdev-1.4.0-2.1.fc35.x86_64/usr/lib64/python3.8/site-packages/evdev/uinput.py:127: in __init__
self._verify()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = UInput('test-py-evdev-uinput', 3, 4352, 8704, 13056, 'py-evdev-uinput')
def _verify(self):
'''
Verify that an uinput device exists and is readable and writable
by the current process.
'''
try:
m = os.stat(self.devnode)[stat.ST_MODE]
if not stat.S_ISCHR(m):
raise
except (IndexError, OSError):
msg = '"{}" does not exist or is not a character device file '\
'- verify that the uinput module is loaded'
raise UInputError(msg.format(self.devnode))
if not os.access(self.devnode, os.W_OK):
msg = '"{}" cannot be opened for writing'
> raise UInputError(msg.format(self.devnode))
E evdev.uinput.UInputError: "/dev/uinput" cannot be opened for writing
../../BUILDROOT/python-evdev-1.4.0-2.1.fc35.x86_64/usr/lib64/python3.8/site-packages/evdev/uinput.py:274: UInputError
____________________________________________________________________________ test_enable_events ____________________________________________________________________________
c = {'bustype': 3, 'events': {1: [30, 48, 46]}, 'name': 'test-py-evdev-uinput', 'product': 8704, ...}
def test_enable_events(c):
e = ecodes
c['events'] = {e.EV_KEY : [e.KEY_A, e.KEY_B, e.KEY_C]}
> with uinput.UInput(**c) as ui:
tests/test_uinput.py:55:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../BUILDROOT/python-evdev-1.4.0-2.1.fc35.x86_64/usr/lib64/python3.8/site-packages/evdev/uinput.py:127: in __init__
self._verify()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = UInput('test-py-evdev-uinput', 3, 4352, 8704, 13056, 'py-evdev-uinput')
def _verify(self):
'''
Verify that an uinput device exists and is readable and writable
by the current process.
'''
try:
m = os.stat(self.devnode)[stat.ST_MODE]
if not stat.S_ISCHR(m):
raise
except (IndexError, OSError):
msg = '"{}" does not exist or is not a character device file '\
'- verify that the uinput module is loaded'
raise UInputError(msg.format(self.devnode))
if not os.access(self.devnode, os.W_OK):
msg = '"{}" cannot be opened for writing'
> raise UInputError(msg.format(self.devnode))
E evdev.uinput.UInputError: "/dev/uinput" cannot be opened for writing
../../BUILDROOT/python-evdev-1.4.0-2.1.fc35.x86_64/usr/lib64/python3.8/site-packages/evdev/uinput.py:274: UInputError
============================================================================= warnings summary =============================================================================
../../BUILDROOT/python-evdev-1.4.0-2.1.fc35.x86_64/usr/lib64/python3.8/site-packages/evdev/eventio_async.py:89
/home/tkloczko/rpmbuild/BUILDROOT/python-evdev-1.4.0-2.1.fc35.x86_64/usr/lib64/python3.8/site-packages/evdev/eventio_async.py:89: DeprecationWarning: "@coroutine" decorator is deprecated since Python 3.8, use "async def" instead
def __anext__(self):
-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================= short test summary info ==========================================================================
FAILED tests/test_uinput.py::test_abs_values - evdev.uinput.UInputError: "/dev/uinput" cannot be opened for writing
FAILED tests/test_uinput.py::test_write - evdev.uinput.UInputError: "/dev/uinput" cannot be opened for writing
FAILED tests/test_uinput.py::test_open - evdev.uinput.UInputError: "/dev/uinput" cannot be opened for writing
FAILED tests/test_uinput.py::test_open_context - evdev.uinput.UInputError: "/dev/uinput" cannot be opened for writing
FAILED tests/test_uinput.py::test_enable_events - evdev.uinput.UInputError: "/dev/uinput" cannot be opened for writing
================================================================== 5 failed, 7 passed, 1 warning in 0.48s ==================================================================
pytest-xprocess reminder::Be sure to terminate the started process by running 'pytest --xkill' if you have not explicitly done so in your fixture with 'xprocess.getinfo(<process_name>).terminate()'.
Gentle ping .. any update? 🤔
try
ls -l /dev/uinput
getfacl /dev/uinput
to figure out the permissions of it. I have, for whatever reason, rw access to this file via its acl. Probably by default. You can replicate this on your system by using sudo setfacl -m u:${USER}:rw /dev/uinput
Running python3 -c "import evdev; evdev.UInput()"
can help you verify if your permissions work.
Both setuptools and pytest based.