bindings: python: tests: fix checking the kernel version
authorBartosz Golaszewski <bgolaszewski@baylibre.com>
Tue, 10 Sep 2019 08:39:12 +0000 (10:39 +0200)
committerBartosz Golaszewski <bgolaszewski@baylibre.com>
Tue, 10 Sep 2019 08:39:12 +0000 (10:39 +0200)
Kernel release candidate version strings seem to not be working
correctly with python's version.parse() function. Split the string
retrieved with os.uname().release using '-' as delimiter and pass
only the first part - 'major.minor.release' - to version.parse().

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
bindings/python/tests/gpiod_py_test.py

index 9cc15af508b233b6d312164e0efd74244c126b56..8533bae340e399f987209e7744a843bf270adbb9 100755 (executable)
@@ -68,7 +68,7 @@ class EventThread(threading.Thread):
         self.join()
 
 def check_kernel(major, minor, release):
-    current = os.uname().release
+    current = os.uname().release.split('-')[0]
     required = '{}.{}.{}'.format(major, minor, release)
     if version.parse(current) < version.parse(required):
         raise NotImplementedError(