Closed toxadx closed 1 year ago
Hello, could you please provide the test results here for future reference? (best to copy the terminal output here, but a screenshot would also be OK).
It would be also great if you could tell what platform
will hold on OpenBSD (or you directly open a PR..)
python-readchar git:(master *%=)$ pytest tests/linux/test_*
=========================================================================== test session starts ============================================================================
platform openbsd7 -- Python 3.9.16, pytest-7.2.2, pluggy-1.0.0
rootdir: /home/toxa/projects/python-readchar, configfile: setup.cfg
plugins: cov-4.0.0
collected 273 items
tests/linux/test_import.py ...
tests/linux/test_keys.py ................................................................................................................
tests/linux/test_readchar.py .....................................................................................................................................
tests/linux/test_readkey.py ........................./home/toxa/projects/python-readchar/venv/lib/python3.9/site-packages/coverage/control.py:858: CoverageWarning: No data was collected. (no-data-collected)
self._warn("No data was collected.", slug="no-data-collected")
--------- coverage: platform openbsd7, python 3.9.16-final-0 ---------
Name Stmts Miss Cover
---------------------------------------------
readchar/__init__.py 11 11 0%
readchar/_base_key.py 31 31 0%
readchar/_config.py 6 6 0%
readchar/_posix_key.py 30 30 0%
readchar/_posix_read.py 30 30 0%
readchar/_win_key.py 28 28 0%
readchar/_win_read.py 12 12 0%
readchar/key.py 6 6 0%
---------------------------------------------
TOTAL 154 154 0%
=========================================================================== 273 passed in 1.36s ============================================================================
Changes to the code made by me:
diff --git a/readchar/__init__.py b/readchar/__init__.py
index b7a83c9..4de5f35 100644
--- a/readchar/__init__.py
+++ b/readchar/__init__.py
@@ -8,7 +8,7 @@ from sys import platform
from ._config import config
-if platform.startswith(("linux", "darwin", "freebsd")):
+if platform.startswith(("linux", "darwin", "freebsd", "openbsd")):
from . import _posix_key as key
from ._posix_read import readchar, readkey
elif platform in ("win32", "cygwin"):
diff --git a/tests/linux/conftest.py b/tests/linux/conftest.py
index 038203f..78eb52d 100644
--- a/tests/linux/conftest.py
+++ b/tests/linux/conftest.py
@@ -3,7 +3,7 @@ import sys
import pytest
-if sys.platform.startswith("linux"):
+if sys.platform.startswith("linux") or sys.platform.startswith('openbsd'):
import termios
Great :+1:
As you allready have the changes made you could make the commit yourself, open a PR and have you name associated with this new feature. But if not I can commit this later today.
(If you want to open a PR, pleas open two seperate ones. One for the changes to the __init__.py
and one for the changes to the tests. I will not merge the second one for the reasons outlined in the other open PRs for FreeBSD and Darwin, but its still good to have it open...)
I haven't made the commit, please commit yourself as it will take too much time to make a PR for me.
I've installed readchar on OpenBSD 7.2, added openbsd to the list on supported platforms and ran tests without any issues. Please add OpenBSD to the list of supported platforms