Skip to content

Commit d21117d

Browse files
tests: fix multi-error data path failure wrt libyang 5.11.9
Since libyang commit e874e58b580f ("log UPDATE always print full data path"), the data path in error messages includes the parent containers. The url list is in the conf container, so the expected paths change. Require soversion 5.11.9, which is the first one with this change, so the tests pass with every libyang version that we accept. Closes: #175 Signed-off-by: Samuel Gauthier <samuel.gauthier@6wind.com>
1 parent d2363c9 commit d21117d

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

‎cffi/source.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
#include <libyang/plugins.h>
88
#include <libyang/version.h>
99

10-
#if LY_VERSION_MAJOR * 10000 + LY_VERSION_MINOR * 100 + LY_VERSION_MICRO < 50505
11-
#error "This version of libyang bindings only works with libyang soversion 5.5.5+"
10+
#if LY_VERSION_MAJOR * 10000 + LY_VERSION_MINOR * 100 + LY_VERSION_MICRO < 51109
11+
#error "This version of libyang bindings only works with libyang soversion 5.11.9+"
1212
#endif

‎tests/test_data.py‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,19 +288,21 @@ def test_data_parse_config_xml_multi_error(self):
288288
self.assertEqual(
289289
str(cm.exception),
290290
'failed to parse data tree: Invalid boolean value "abcd".: '
291-
"Data path: /yolo-system:url[proto='https']/enabled (line 6): "
291+
"Data path: /yolo-system:conf/url[proto='https']/enabled (line 6): "
292292
'List instance is missing its key "host".: '
293-
"Data path: /yolo-system:url[proto='https'] (line 7)",
293+
"Data path: /yolo-system:conf/url[proto='https'] (line 7)",
294294
)
295295

296296
first = cm.exception.errors[0]
297297
self.assertEqual(first.msg, 'Invalid boolean value "abcd".')
298-
self.assertEqual(first.data_path, "/yolo-system:url[proto='https']/enabled")
298+
self.assertEqual(
299+
first.data_path, "/yolo-system:conf/url[proto='https']/enabled"
300+
)
299301
self.assertEqual(first.line, 6)
300302

301303
second = cm.exception.errors[1]
302304
self.assertEqual(second.msg, 'List instance is missing its key "host".')
303-
self.assertEqual(second.data_path, "/yolo-system:url[proto='https']")
305+
self.assertEqual(second.data_path, "/yolo-system:conf/url[proto='https']")
304306
self.assertEqual(second.line, 7)
305307

306308
XML_STATE = """<state xmlns="urn:yang:yolo:system">

0 commit comments

Comments
 (0)