From e120d3e996e78ae1f6a5b330d14090c5060fd38a Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Fri, 9 Oct 2020 14:22:09 +0200 Subject: [PATCH] bindings: python: tests: add a test-case exposing a bug in Line.request() Calling Line.request() with no keyword arguments leads to an exception being raised by PyDict_Size(). Add a test-case exposing this bug. It will be fixed in the subsequent commit. Reported-by: Jiri Benc Signed-off-by: Bartosz Golaszewski --- bindings/python/tests/gpiod_py_test.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bindings/python/tests/gpiod_py_test.py b/bindings/python/tests/gpiod_py_test.py index 572aad8..52a82c5 100755 --- a/bindings/python/tests/gpiod_py_test.py +++ b/bindings/python/tests/gpiod_py_test.py @@ -719,6 +719,15 @@ class LineRequestBehavior(MockupTestCase): self.assertEqual(err_ctx.exception.errno, errno.EPERM) + def test_request_with_no_kwds(self): + with gpiod.Chip(mockup.chip_name(0)) as chip: + line = chip.get_line(2) + line.request(default_consumer) + self.assertTrue(line.is_requested()) + self.assertEqual(line.direction(), gpiod.Line.DIRECTION_INPUT) + line.release() + self.assertFalse(line.is_requested()) + # # Iterator test cases # -- 2.30.2