mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-09-30 22:11:59 -09:00
support/tests: add runtime test for python-rpi-gpio
Modeled after similar python packages. However, this one is picky, and throws an exception when it detects that it is not running on a Raspberry Pi. So we just catch that exception and check this is what we expect. Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr> Cc: Christian Stewart <christian@paral.in> Cc: Michael Fischer <mf@go-sys.de> Cc: Asaf Kahlon <asafka7@gmail.com> Cc: Yegor Yefremov <yegorslists@googlemail.com> Cc: Ian Haylock <haylocki@yahoo.co.uk> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
committed by
Thomas Petazzoni
parent
ae6bd1eb44
commit
071dbfeb4d
6
support/testing/tests/package/sample_python_rpi_gpio.py
Normal file
6
support/testing/tests/package/sample_python_rpi_gpio.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
try:
|
||||||
|
import RPi.GPIO # noqa
|
||||||
|
except RuntimeError as e:
|
||||||
|
assert(str(e) == 'This module can only be run on a Raspberry Pi!')
|
||||||
|
else:
|
||||||
|
raise RuntimeError('Import succeeded when it should not have!')
|
||||||
11
support/testing/tests/package/test_python_rpi_gpio.py
Normal file
11
support/testing/tests/package/test_python_rpi_gpio.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
from tests.package.test_python import TestPythonPackageBase
|
||||||
|
|
||||||
|
|
||||||
|
class TestPythonPy3RpiGpio(TestPythonPackageBase):
|
||||||
|
__test__ = True
|
||||||
|
config = TestPythonPackageBase.config + \
|
||||||
|
"""
|
||||||
|
BR2_PACKAGE_PYTHON3=y
|
||||||
|
BR2_PACKAGE_PYTHON_RPI_GPIO=y
|
||||||
|
"""
|
||||||
|
sample_scripts = ["tests/package/sample_python_rpi_gpio.py"]
|
||||||
Reference in New Issue
Block a user