nanobind icon indicating copy to clipboard operation
nanobind copied to clipboard

[BUG]: `test01_check_stub_refs[p_ref5]` failing on `2.2.0` release

Open phiadaarr opened this issue 4 months ago • 0 comments

Problem description

When I run the test of the 2.2.0 release of nanobind, I get a error in the stub check tests:

=================================== FAILURES ===================================
________________________ test01_check_stub_refs[p_ref5] ________________________

p_ref = PosixPath('/build/source/tests/test_ndarray_ext.pyi.ref')

    @skip_on_unsupported
    @pytest.mark.parametrize('p_ref', ref_paths)
    def test01_check_stub_refs(p_ref):
        """
        Check that generated stub files match reference input
        """
        p_in = p_ref.with_suffix('')
        with open(p_ref, 'r') as f:
            s_ref = f.read().split('\n')
        with open(p_in, 'r') as f:
            s_in = f.read().split('\n')
        s_in = remove_platform_dependent(s_in)
        s_ref = remove_platform_dependent(s_ref)

        diff = list(difflib.unified_diff(
            s_ref,
            s_in,
            fromfile=str(p_ref),
            tofile=str(p_in)
        ))
        if len(diff):
            for p in diff:
                print(p.rstrip(), file=sys.stderr)
            print(
                '\nWarning: generated stubs do not match their references. If you\n'
                'intentionally changed a test suite extension, it may be necessary\n'
                'to replace the .pyi.ref file with the generated .pyi file. But\n'
                'please double-check that the change makes sense.',
                file=sys.stderr
            )
>           assert False
E           assert False

tests/test_stubs.py:60: AssertionError
----------------------------- Captured stderr call -----------------------------
--- /build/source/tests/test_ndarray_ext.pyi.ref
+++ /build/source/tests/test_ndarray_ext.pyi
@@ -2,7 +2,7 @@

 import jaxlib.xla_extension
 from numpy.typing import ArrayLike
-import tensorflow.python.framework.ops
+import tensorflow


 class Cls:

Warning: generated stubs do not match their references. If you
intentionally changed a test suite extension, it may be necessary
to replace the .pyi.ref file with the generated .pyi file. But
please double-check that the change makes sense.
=========================== short test summary info ============================
FAILED tests/test_stubs.py::test01_check_stub_refs[p_ref5] - assert False

Do you have any idea what could be going wrong here?

Reproducible example code

git clone --depth 1 -b python3Packages.nanobind_2_2_0 https://github.com/phiadaarr/nixpkgs
cd nixpkgs
nix-build -A python3Packages.nanobind

phiadaarr avatar Oct 06 '24 20:10 phiadaarr