Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.8.1: pytest fails #113

Open
kloczek opened this issue Feb 10, 2024 · 1 comment
Open

0.8.1: pytest fails #113

kloczek opened this issue Feb 10, 2024 · 1 comment

Comments

@kloczek
Copy link

kloczek commented Feb 10, 2024

  • python3 -sBm build -w --no-isolation
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix> using 'installer` module
  • run pytest with $PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
  • build is performed in env which is cut off from access to the public network (pytest is executed with -m "not network")
Here is pytest output:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-editdistance-0.8.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-editdistance-0.8.1-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
==================================================================================== test session starts ====================================================================================
platform linux -- Python 3.8.18, pytest-8.0.0, pluggy-1.3.0
rootdir: /home/tkloczko/rpmbuild/BUILD/editdistance-0.8.1
collected 4 items

test/test_editdistance.py FFFF                                                                                                                                                        [100%]

========================================================================================= FAILURES ==========================================================================================
___________________________________________________________________________ TestEditDistance.test_dp_editdistance ___________________________________________________________________________

self = <test_editdistance.TestEditDistance testMethod=test_dp_editdistance>

    def test_dp_editdistance(self):
>       from editdistance.bycython import eval_dp

test/test_editdistance.py:16:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

>   from .bycython import eval, eval_criterion
E   ImportError: cannot import name 'eval_criterion' from 'editdistance.bycython' (/home/tkloczko/rpmbuild/BUILDROOT/python-editdistance-0.8.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages/editdistance/bycython.cpython-38-x86_64-linux-gnu.so)

../../BUILDROOT/python-editdistance-0.8.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages/editdistance/__init__.py:1: ImportError
____________________________________________________________________________ TestEditDistance.test_dp_vs_default ____________________________________________________________________________

self = <test_editdistance.TestEditDistance testMethod=test_dp_vs_default>

    def test_dp_vs_default(self):
        for _ in range(10):
>           import editdistance

test/test_editdistance.py:22:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

>   from .bycython import eval, eval_criterion
E   ImportError: cannot import name 'eval_criterion' from 'editdistance.bycython' (/home/tkloczko/rpmbuild/BUILDROOT/python-editdistance-0.8.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages/editdistance/bycython.cpython-38-x86_64-linux-gnu.so)

../../BUILDROOT/python-editdistance-0.8.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages/editdistance/__init__.py:1: ImportError
____________________________________________________________________________ TestEditDistance.test_editdistance _____________________________________________________________________________

self = <test_editdistance.TestEditDistance testMethod=test_editdistance>

    def test_editdistance(self):
>       import editdistance

test/test_editdistance.py:7:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

>   from .bycython import eval, eval_criterion
E   ImportError: cannot import name 'eval_criterion' from 'editdistance.bycython' (/home/tkloczko/rpmbuild/BUILDROOT/python-editdistance-0.8.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages/editdistance/bycython.cpython-38-x86_64-linux-gnu.so)

../../BUILDROOT/python-editdistance-0.8.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages/editdistance/__init__.py:1: ImportError
_______________________________________________________________________ TestEditDistance.test_editdistance_criterion ________________________________________________________________________

self = <test_editdistance.TestEditDistance testMethod=test_editdistance_criterion>

    def test_editdistance_criterion(self):
>       import editdistance

test/test_editdistance.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

>   from .bycython import eval, eval_criterion
E   ImportError: cannot import name 'eval_criterion' from 'editdistance.bycython' (/home/tkloczko/rpmbuild/BUILDROOT/python-editdistance-0.8.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages/editdistance/bycython.cpython-38-x86_64-linux-gnu.so)

../../BUILDROOT/python-editdistance-0.8.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages/editdistance/__init__.py:1: ImportError
================================================================================== short test summary info ==================================================================================
FAILED test/test_editdistance.py::TestEditDistance::test_dp_editdistance - ImportError: cannot import name 'eval_criterion' from 'editdistance.bycython' (/home/tkloczko/rpmbuild/BUILDROOT/python-editdistance-0.8.1-2.fc35.x86_64/usr/lib64/python3.8/site-packag...
FAILED test/test_editdistance.py::TestEditDistance::test_dp_vs_default - ImportError: cannot import name 'eval_criterion' from 'editdistance.bycython' (/home/tkloczko/rpmbuild/BUILDROOT/python-editdistance-0.8.1-2.fc35.x86_64/usr/lib64/python3.8/site-packag...
FAILED test/test_editdistance.py::TestEditDistance::test_editdistance - ImportError: cannot import name 'eval_criterion' from 'editdistance.bycython' (/home/tkloczko/rpmbuild/BUILDROOT/python-editdistance-0.8.1-2.fc35.x86_64/usr/lib64/python3.8/site-packag...
FAILED test/test_editdistance.py::TestEditDistance::test_editdistance_criterion - ImportError: cannot import name 'eval_criterion' from 'editdistance.bycython' (/home/tkloczko/rpmbuild/BUILDROOT/python-editdistance-0.8.1-2.fc35.x86_64/usr/lib64/python3.8/site-packag...
===================================================================================== 4 failed in 0.11s =====================================================================================
List of installed modules in build env:
Package            Version
------------------ --------
build              1.0.3
cppclean           0.13
Cython             3.0.8
distro             1.9.0
dnf                4.18.2
exceptiongroup     1.1.3
gpg                1.23.2
importlib_metadata 7.0.1
iniconfig          2.0.0
installer          0.7.0
libdnf             0.73.0
packaging          23.2
pdm-backend        2.1.8
pluggy             1.3.0
pyproject_hooks    1.0.0
pyproject-metadata 0.7.1
pytest             8.0.0
python-dateutil    2.8.2
setuptools         69.0.3
six                1.16.0
tomli              2.0.1
tomli_w            1.0.0
wheel              0.42.0
zipp               3.17.0

Please let me know if you need more details or want me to perform some diagnostics.

@roy-ht
Copy link
Owner

roy-ht commented Feb 11, 2024

i can't reproduce your error (On Ubuntu 22.04)

❯ python3 -sBm build -w --no-isolation
...

- Adding .pdm-build/.gitignore -> .gitignore
 - Adding .pdm-build/editdistance-0.8.1.dist-info/METADATA -> editdistance-0.8.1.dist-info/METADATA
 - Adding .pdm-build/editdistance-0.8.1.dist-info/WHEEL -> editdistance-0.8.1.dist-info/WHEEL
 - Adding .pdm-build/editdistance-0.8.1.dist-info/licenses/LICENSE -> editdistance-0.8.1.dist-info/licenses/LICENSE
 - Adding .pdm-build/editdistance/__init__.pxd -> editdistance/__init__.pxd
 - Adding .pdm-build/editdistance/__init__.py -> editdistance/__init__.py
 - Adding .pdm-build/editdistance/_editdistance.cpp -> editdistance/_editdistance.cpp
 - Adding .pdm-build/editdistance/_editdistance.h -> editdistance/_editdistance.h
 - Adding .pdm-build/editdistance/bycython.cpp -> editdistance/bycython.cpp
 - Adding .pdm-build/editdistance/bycython.cpython-38-x86_64-linux-gnu.so -> editdistance/bycython.cpython-38-x86_64-linux-gnu.so
 - Adding .pdm-build/editdistance/bycython.pxd -> editdistance/bycython.pxd
 - Adding .pdm-build/editdistance/bycython.pyx -> editdistance/bycython.pyx
 - Adding .pdm-build/editdistance/def.h -> editdistance/def.h
 - Adding editdistance-0.8.1.dist-info/RECORD -> editdistance-0.8.1.dist-info/RECORD
Successfully built editdistance-0.8.1-cp38-cp38-linux_x86_64.whl
❯ python -m installer --destdir temp dist/editdistance-0.8.1-cp38-cp38-linux_x86_64.whl
❯ nm -gD temp/.../.virtualenvs/py38/lib/python3.8/site-packages/editdistance/bycython.cpython-38-x86_64-linux-gnu.so
...

000000000000c960 W _Z17edit_distancec_dpIlEbPKT_mS2_mj
000000000000c350 W _Z18edit_distance_map_ILm10EEjPKlmS1_m
000000000000d070 W _Z18edit_distance_map_ILm1EEjPKlmS1_m
0000000000009540 W _Z18edit_distance_map_ILm2EEjPKlmS1_m
0000000000009ad0 W _Z18edit_distance_map_ILm3EEjPKlmS1_m
000000000000a050 W _Z18edit_distance_map_ILm4EEjPKlmS1_m
000000000000a650 W _Z18edit_distance_map_ILm5EEjPKlmS1_m
000000000000ac40 W _Z18edit_distance_map_ILm6EEjPKlmS1_m
000000000000b210 W _Z18edit_distance_map_ILm7EEjPKlmS1_m
000000000000b7d0 W _Z18edit_distance_map_ILm8EEjPKlmS1_m
000000000000bd90 W _Z18edit_distance_map_ILm9EEjPKlmS1_m
000000000000c910 W _ZNSt12_Destroy_auxILb0EE9__destroyIPSt6vectorIjSaIjEEEEvT_S6_
000000000000ce30 W _ZNSt8_Rb_treeIlSt4pairIKl4varrILm1EEESt10_Select1stIS4_ESt4lessIlESaIS4_EE29_M_get_insert_hint_unique_posESt23_Rb_tree_const_iteratorIS4_ERS1_
                 U _ZNSt8ios_base4InitC1Ev@GLIBCXX_3.4
                 U _ZNSt8ios_base4InitD1Ev@GLIBCXX_3.4
                 U _ZSt17__throw_bad_allocv@GLIBCXX_3.4
                 U _ZSt18_Rb_tree_decrementPSt18_Rb_tree_node_base@GLIBCXX_3.4
                 U _ZSt18_Rb_tree_incrementPSt18_Rb_tree_node_base@GLIBCXX_3.4
                 U _ZSt20__throw_length_errorPKc@GLIBCXX_3.4
                 U _ZSt28__throw_bad_array_new_lengthv@GLIBCXX_3.4.29
                 U _ZSt29_Rb_tree_insert_and_rebalancebPSt18_Rb_tree_node_baseS0_RS_@GLIBCXX_3.4
                 U _ZdlPvm@CXXABI_1.3.9
                 U _Znwm@GLIBCXX_3.4
                 U __cxa_atexit@GLIBC_2.2.5
                 U __cxa_begin_catch@CXXABI_1.3
                 U __cxa_end_catch@CXXABI_1.3
                 w __cxa_finalize@GLIBC_2.2.5
                 U __cxa_rethrow@CXXABI_1.3
                 w __gmon_start__
                 U __gxx_personality_v0@CXXABI_1.3
0000000000017a40 B __pyx_module_is_main_editdistance__bycython
                 U __stack_chk_fail@GLIBC_2.4
00000000000066c0 T edit_distance
0000000000006270 T edit_distance_criterion
00000000000062d0 T edit_distance_dp

Please check your .so file contains edit_distance_criterion symbol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants