bindings: python: fix running tests via Makefile
cover bindings: python: fix running tests via Makefile
Recently I couldn't work out how to run the test suite for the Python bindings. There were two problems, the make target did not run the tests correctly, and the tests need to be run as root. This series fixes the Makefile so the tests can be run via the make target, and documents how to call it as it isn't totally obvious.
Patch 1 adds a Testing section to the README to clarify how to run the tests.
Patch 2 fixes the python-tests-run make target so it will run the tests as intended.
Kent Gibson (2):
bindings: python: add Testing section to README
bindings: python: fix python-tests-run make target
bindings/python/Makefile.am | 6 +++--- bindings/python/README.md | 10 ++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-)
--
2.39.2
PATCH 1/2 bindings: python: add Testing section to README
Add a section describing how to run the test suite.
--- bindings/python/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+)
bindings/python/README.md +10 -0
@@ -102,3 +102,13 @@ with gpiod.request_lines( time.sleep(1) ``` +## Testing + +The test suite for the python bindings can be run by calling: + +``` +make python-tests-run +``` + +from the `libgpiod/bindings/python` directory as root (necessary to be able +to create the **gpio-sims** used for testing).
Signature · 1 line
2.39.2
PATCH 2/2 bindings: python: fix python-tests-run make target
In reply to Kent GibsonThe python-tests-run target is broken as it does not correctly split lines. It also calls Python directly rather then through the $PYTHON variable.
Fix the line splitting and call Python using the $PYTHON variable.
--- bindings/python/Makefile.am | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
bindings/python/Makefile.am +3 -3
@@ -13,10 +13,10 @@ python-tests: $(PYTHON) build_tests.py python-tests-run: - PYTHONPATH=$(abs_top_srcdir)/bindings/python + PYTHONPATH=$(abs_top_srcdir)/bindings/python \ LD_LIBRARY_PATH=$(abs_top_builddir)/lib/.libs/:\ - $(abs_top_builddir)/tests/gpiosim/.libs/ \ - python3 -B -m tests + $(abs_top_builddir)/tests/gpiosim/.libs/ \ + $(PYTHON) -B -m tests else
Signature · 1 line
2.39.2
Bartosz Golaszewski
AppliedFrom: Bartosz Golaszewski <[email protected]>
Quoted 10 lines · Kent Gibson
Recently I couldn't work out how to run the test suite for the Python bindings. There were two problems, the make target did not run the tests correctly, and the tests need to be run as root. This series fixes the
Makefileso the tests can be run via the make target, and documents how to call it as it isn't totally obvious.Patch 1 adds a Testing section to the README to clarify how to run the tests.
[...]
Applied, thanks!
[1/2] bindings: python: add Testing section to README
commit: 8635780c1c21d7833c960d49a796be5553b3f624
[2/2] bindings: python: fix python-tests-run make target
commit: dee10f08070d97d9dc8b1dfde7576fb1a8d81cc6Best regards,
Signature · 1 line
Bartosz Golaszewski <[email protected]>