Skip to content

Commit

Permalink
libyang: support backslashes in file names on Windows (again)
Browse files Browse the repository at this point in the history
There are some failures with `gnpy` on Windows:

 ================================== FAILURES ===================================
 ____________ test_lint_yang[ietf-network-topology@2018-02-26.yang] ____________

 yang_model = WindowsPath('D:/a/oopt-gnpy/oopt-gnpy/gnpy/yang/ext/ietf-network-topology@2018-02-26.yang')

     @pytest.mark.parametrize("yang_model", [x for x in external_path().glob('*.yang')] + [x for x in model_path().glob('*.yang')], ids=_get_basename)
     def test_lint_yang(yang_model):
         '''Run a linter on each YANG model'''
         c = ly.Context(str(external_path()) + os.pathsep + str(model_path()),
                        ly.ContextOptions.NoYangLibrary | ly.ContextOptions.DisableSearchCwd)
         assert c.parse_module(yang_model, ly.SchemaFormat.YANG) is not None
 >       assert c.errors() == []
 E       assert <[TypeError("unhashable type: 'instancemethod'") raised in repr()] list object at 0x1880e5958c0> == []
 E         (pytest_assertion plugin: representation of details failed: C:\hostedtoolcache\windows\Python\3.11.4\x64\Lib\pprint.py:178: TypeError: unhashable type: 'instancemethod'.
 E          Probably an object has a faulty __repr__.)

 tests\test_yang_lint.py:30: AssertionError
 ---------------------------- Captured stderr call -----------------------------
 libyang[1]: File name "D:\a\oopt-gnpy\oopt-gnpy\gnpy\yang\ext\ietf-network-topology@2018-02-26.yang" does not match module name "ietf-network-topology".
 ________________ test_lint_yang[ietf-network@2018-02-26.yang] _________________

That complaint about __repr__ is an impedance mismatch between pybind11
and Python (pybind/pybind11#2722), but in this case that whole thing is
triggered through a bug in libyang which assumes that the directory
separator is always `/`.

Bug: CESNET/libyang#2093
  • Loading branch information
jktjkt committed Sep 5, 2023
1 parent e629297 commit 1a40787
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libyang

0 comments on commit 1a40787

Please sign in to comment.