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

Tests do not run in PEP517 out-of-source build (gentoo) #101

Open
mschubert opened this issue Jul 16, 2024 · 5 comments
Open

Tests do not run in PEP517 out-of-source build (gentoo) #101

mschubert opened this issue Jul 16, 2024 · 5 comments

Comments

@mschubert
Copy link

When trying to run the tests of a locally built wheel, I run into errors in the collection phase. The steps are, roughly:

  1. Build the wheel (works fine)
  2. Install the wheel in a temporary location (works fine)
  3. Run the tests (errors on test collection)
# build wheel
python3.12 -m gpep517 build-wheel --prefix=/my_dir/usr --backend setuptools.build_meta --output-fd 3 --wheel-dir /my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0-python3_12/wheel

# install wheel
python3.12 -m gpep517 install-wheel --destdir=/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0-python3_12/install --interpreter=/my_dir/usr/bin/python3.12 --prefix=/my_dir/usr --optimize=all /my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0-python3_12/wheel/bx_python-0.12.0-cp312-cp312-linux_x86_64.whl

# run tests
# cd into dir
python3.12 -m pytest -vv -ra -l -Wdefault -Werror::pytest.PytestUnhandledCoroutineWarning --color=yes -o console_output_style=count -o tmp_path_retention_count=0 -o tmp_path_retention_policy=failed -p no:cov -p no:flake8 -p no:flakes -p no:pylint -p no:markdown -p no:sugar -p no:xvfb -p no:pytest-describe -p no:plus -p no:tavern -p no:salt-factories

The relevant sections are:

ImportError while importing test module _epo
Hint: make sure your test modules/packages have valid Python names.
E   ModuleNotFoundError: No module named 'bx.align._epo'
# or:
E   ModuleNotFoundError: No module named 'bx.align.sitemask._cpg'
# or:
E   ModuleNotFoundError: No module named 'bx.arrays.array_tree'
# or:
E   ModuleNotFoundError: No module named 'bx.bbi.bigwig_file'
# or:
E   ModuleNotFoundError: No module named 'bx.bitset'
# and others
E   ImportError: cannot import name '_nib' from partially initialized module 'bx.seq' (most likely due to a circular import)

This always worked fine with other packages, so I'm not sure what's going wrong here.

Detailed log here (including package versions)
2024-07-16 09:58:34,058 gpep517 INFO The backend produced /my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0-python3_12/wheel/bx_python-0.12.0-cp312-cp312-linux_x86_64.whl
 /my_dir/*   Installing bx_python-0.12.0-cp312-cp312-linux_x86_64.whl to /my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0-python3_12/install
python3.12 -m gpep517 install-wheel --destdir=/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0-python3_12/install --interpreter=/my_dir/usr/bin/python3.12 --prefix=/my_dir/usr --optimize=all /my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0-python3_12/wheel/bx_python-0.12.0-cp312-cp312-linux_x86_64.whl
2024-07-16 09:58:35,223 gpep517 INFO Installing /my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0-python3_12/wheel/bx_python-0.12.0-cp312-cp312-linux_x86_64.whl into /my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0-python3_12/install
2024-07-16 09:58:36,175 gpep517 INFO Installation complete
>>> Source compiled.
>>> Test phase: sci-biology/bx-python-0.12.0
 /my_dir/* python3_12: running distutils-r1_run_phase python_test
python3.12 -m pytest -vv -ra -l -Wdefault -Werror::pytest.PytestUnhandledCoroutineWarning --color=yes -o console_output_style=count -o tmp_path_retention_count=0 -o tmp_path_retention_policy=failed -p no:cov -p no:flake8 -p no:flakes -p no:pylint -p no:markdown -p no:sugar -p no:xvfb -p no:pytest-describe -p no:plus -p no:tavern -p no:salt-factories
============================= test session starts ==============================
platform linux -- Python 3.12.4, pytest-8.2.2, pluggy-1.5.0 -- /my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0-python3_12/install/my_dir/usr/bin/python3.12
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase(PosixPath('/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0/.hypothesis/examples'))
rootdir: /my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0
configfile: pytest.ini
testpaths: lib, script_tests/
plugins: asyncio-0.23.7, hypothesis-6.103.2, pkgcore-0.12.27, typeguard-4.3.0
asyncio: mode=Mode.STRICT
collecting ... collected 62 items / 18 errors

==================================== ERRORS ====================================
__________________ ERROR collecting lib/bx/align/epo_tests.py __________________
ImportError while importing test module '/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0/lib/bx/align/epo_tests.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../../../../../usr/lib/python3.12/site-packages/_pytest/python.py:492: in importtestmodule
    mod = import_path(
../../../../../../../usr/lib/python3.12/site-packages/_pytest/pathlib.py:591: in import_path
    importlib.import_module(module_name)
../../../../../../../usr/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
../../../../../../../usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
lib/bx/align/epo_tests.py:9: in <module>
    from bx.align._epo import (
E   ModuleNotFoundError: No module named 'bx.align._epo'
__________________ ERROR collecting lib/bx/align/lav_tests.py __________________
ImportError while importing test module '/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0/lib/bx/align/lav_tests.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../../../../../usr/lib/python3.12/site-packages/_pytest/python.py:492: in importtestmodule
    mod = import_path(
../../../../../../../usr/lib/python3.12/site-packages/_pytest/pathlib.py:591: in import_path
    importlib.import_module(module_name)
../../../../../../../usr/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
../../../../../../../usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
lib/bx/align/lav_tests.py:7: in <module>
    import bx.align.lav as lav
lib/bx/align/lav.py:11: in <module>
    import bx.seq
lib/bx/seq/__init__.py:7: in <module>
    from bx.seq.core import *  # noqa: F40
lib/bx/seq/core.py:11: in <module>
    from . import (
lib/bx/seq/nib.py:30: in <module>
    from . import _nib
E   ImportError: cannot import name '_nib' from partially initialized module 'bx.seq' (most likely due to a circular import) (/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0/lib/bx/seq/__init__.py)
___________ ERROR collecting lib/bx/align/sitemask/sitemask_tests.py ___________
ImportError while importing test module '/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0/lib/bx/align/sitemask/sitemask_tests.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../../../../../usr/lib/python3.12/site-packages/_pytest/python.py:492: in importtestmodule
    mod = import_path(
../../../../../../../usr/lib/python3.12/site-packages/_pytest/pathlib.py:591: in import_path
    importlib.import_module(module_name)
../../../../../../../usr/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
../../../../../../../usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
lib/bx/align/sitemask/sitemask_tests.py:9: in <module>
    from bx.align.sitemask import cpg
lib/bx/align/sitemask/cpg.py:6: in <module>
    from ._cpg import (
E   ModuleNotFoundError: No module named 'bx.align.sitemask._cpg'
______________ ERROR collecting lib/bx/arrays/array_tree_tests.py ______________
ImportError while importing test module '/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0/lib/bx/arrays/array_tree_tests.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../../../../../usr/lib/python3.12/site-packages/_pytest/python.py:492: in importtestmodule
    mod = import_path(
../../../../../../../usr/lib/python3.12/site-packages/_pytest/pathlib.py:591: in import_path
    importlib.import_module(module_name)
../../../../../../../usr/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
../../../../../../../usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
lib/bx/arrays/array_tree_tests.py:11: in <module>
    from bx.arrays.array_tree import (
E   ModuleNotFoundError: No module named 'bx.arrays.array_tree'
_________________ ERROR collecting lib/bx/bbi/bigwig_tests.py __________________
ImportError while importing test module '/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0/lib/bx/bbi/bigwig_tests.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../../../../../usr/lib/python3.12/site-packages/_pytest/python.py:492: in importtestmodule
    mod = import_path(
../../../../../../../usr/lib/python3.12/site-packages/_pytest/pathlib.py:591: in import_path
    importlib.import_module(module_name)
../../../../../../../usr/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
../../../../../../../usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
lib/bx/bbi/bigwig_tests.py:12: in <module>
    from bx.bbi.bigwig_file import BigWigFile
E   ModuleNotFoundError: No module named 'bx.bbi.bigwig_file'
___________________ ERROR collecting lib/bx/bitset_tests.py ____________________
ImportError while importing test module '/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0/lib/bx/bitset_tests.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../../../../../usr/lib/python3.12/site-packages/_pytest/python.py:492: in importtestmodule
    mod = import_path(
../../../../../../../usr/lib/python3.12/site-packages/_pytest/pathlib.py:591: in import_path
    importlib.import_module(module_name)
../../../../../../../usr/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
../../../../../../../usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
lib/bx/bitset_tests.py:7: in <module>
    import bx.bitset
E   ModuleNotFoundError: No module named 'bx.bitset'
______________ ERROR collecting lib/bx/intervals/cluster_tests.py ______________
ImportError while importing test module '/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0/lib/bx/intervals/cluster_tests.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../../../../../usr/lib/python3.12/site-packages/_pytest/python.py:492: in importtestmodule
    mod = import_path(
../../../../../../../usr/lib/python3.12/site-packages/_pytest/pathlib.py:591: in import_path
    importlib.import_module(module_name)
../../../../../../../usr/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1310: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:995: in exec_module
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
lib/bx/intervals/__init__.py:7: in <module>
    from bx.intervals.intersection import *  # noqa: F40
E   ModuleNotFoundError: No module named 'bx.intervals.intersection'
___________ ERROR collecting lib/bx/intervals/intersection_tests.py ____________
ImportError while importing test module '/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0/lib/bx/intervals/intersection_tests.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../../../../../usr/lib/python3.12/site-packages/_pytest/python.py:492: in importtestmodule
    mod = import_path(
../../../../../../../usr/lib/python3.12/site-packages/_pytest/pathlib.py:591: in import_path
    importlib.import_module(module_name)
../../../../../../../usr/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1310: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:995: in exec_module
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
lib/bx/intervals/__init__.py:7: in <module>
    from bx.intervals.intersection import *  # noqa: F40
E   ModuleNotFoundError: No module named 'bx.intervals.intersection'
__________________ ERROR collecting lib/bx/misc/bgzf_tests.py __________________
ImportError while importing test module '/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0/lib/bx/misc/bgzf_tests.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../../../../../usr/lib/python3.12/site-packages/_pytest/python.py:492: in importtestmodule
    mod = import_path(
../../../../../../../usr/lib/python3.12/site-packages/_pytest/pathlib.py:591: in import_path
    importlib.import_module(module_name)
../../../../../../../usr/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
../../../../../../../usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
lib/bx/misc/bgzf_tests.py:1: in <module>
    import bx.misc.bgzf
E   ModuleNotFoundError: No module named 'bx.misc.bgzf'
_______________ ERROR collecting lib/bx/misc/seekbzip2_tests.py ________________
ImportError while importing test module '/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0/lib/bx/misc/seekbzip2_tests.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../../../../../usr/lib/python3.12/site-packages/_pytest/python.py:492: in importtestmodule
    mod = import_path(
../../../../../../../usr/lib/python3.12/site-packages/_pytest/pathlib.py:591: in import_path
    importlib.import_module(module_name)
../../../../../../../usr/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
../../../../../../../usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
lib/bx/misc/seekbzip2_tests.py:10: in <module>
    from bx.misc import seekbzip2
lib/bx/misc/seekbzip2.py:7: in <module>
    from ._seekbzip2 import SeekBzip2
E   ModuleNotFoundError: No module named 'bx.misc._seekbzip2'
______________ ERROR collecting lib/bx/motif/io/transfac_tests.py ______________
ImportError while importing test module '/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0/lib/bx/motif/io/transfac_tests.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../../../../../usr/lib/python3.12/site-packages/_pytest/python.py:492: in importtestmodule
    mod = import_path(
../../../../../../../usr/lib/python3.12/site-packages/_pytest/pathlib.py:591: in import_path
    importlib.import_module(module_name)
../../../../../../../usr/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
../../../../../../../usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
lib/bx/motif/io/transfac_tests.py:5: in <module>
    from bx.motif.io import transfac
lib/bx/motif/io/transfac.py:5: in <module>
    from bx.motif.pwm import FrequencyMatrix
lib/bx/motif/pwm.py:19: in <module>
    from . import _pwm
E   ImportError: cannot import name '_pwm' from 'bx.motif' (/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0/lib/bx/motif/__init__.py)
__________________ ERROR collecting lib/bx/motif/pwm_tests.py __________________
ImportError while importing test module '/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0/lib/bx/motif/pwm_tests.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../../../../../usr/lib/python3.12/site-packages/_pytest/python.py:492: in importtestmodule
    mod = import_path(
../../../../../../../usr/lib/python3.12/site-packages/_pytest/pathlib.py:591: in import_path
    importlib.import_module(module_name)
../../../../../../../usr/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
../../../../../../../usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
lib/bx/motif/pwm_tests.py:6: in <module>
    from bx.motif import pwm
lib/bx/motif/pwm.py:19: in <module>
    from . import _pwm
E   ImportError: cannot import name '_pwm' from 'bx.motif' (/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0/lib/bx/motif/__init__.py)
__________________ ERROR collecting lib/bx/seq/fasta_tests.py __________________
ImportError while importing test module '/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0/lib/bx/seq/fasta_tests.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../../../../../usr/lib/python3.12/site-packages/_pytest/python.py:492: in importtestmodule
    mod = import_path(
../../../../../../../usr/lib/python3.12/site-packages/_pytest/pathlib.py:591: in import_path
    importlib.import_module(module_name)
../../../../../../../usr/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1310: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:995: in exec_module
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
lib/bx/seq/__init__.py:7: in <module>
    from bx.seq.core import *  # noqa: F40
lib/bx/seq/core.py:11: in <module>
    from . import (
lib/bx/seq/nib.py:30: in <module>
    from . import _nib
E   ImportError: cannot import name '_nib' from partially initialized module 'bx.seq' (most likely due to a circular import) (/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0/lib/bx/seq/__init__.py)
___________________ ERROR collecting lib/bx/seq/nib_tests.py ___________________
ImportError while importing test module '/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0/lib/bx/seq/nib_tests.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../../../../../usr/lib/python3.12/site-packages/_pytest/python.py:492: in importtestmodule
    mod = import_path(
../../../../../../../usr/lib/python3.12/site-packages/_pytest/pathlib.py:591: in import_path
    importlib.import_module(module_name)
../../../../../../../usr/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1310: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:995: in exec_module
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
lib/bx/seq/__init__.py:7: in <module>
    from bx.seq.core import *  # noqa: F40
lib/bx/seq/core.py:11: in <module>
    from . import (
lib/bx/seq/nib.py:30: in <module>
    from . import _nib
E   ImportError: cannot import name '_nib' from partially initialized module 'bx.seq' (most likely due to a circular import) (/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0/lib/bx/seq/__init__.py)
__________________ ERROR collecting lib/bx/seq/qdna_tests.py ___________________
ImportError while importing test module '/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0/lib/bx/seq/qdna_tests.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../../../../../usr/lib/python3.12/site-packages/_pytest/python.py:492: in importtestmodule
    mod = import_path(
../../../../../../../usr/lib/python3.12/site-packages/_pytest/pathlib.py:591: in import_path
    importlib.import_module(module_name)
../../../../../../../usr/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1310: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:995: in exec_module
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
lib/bx/seq/__init__.py:7: in <module>
    from bx.seq.core import *  # noqa: F40
lib/bx/seq/core.py:11: in <module>
    from . import (
lib/bx/seq/nib.py:30: in <module>
    from . import _nib
E   ImportError: cannot import name '_nib' from partially initialized module 'bx.seq' (most likely due to a circular import) (/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0/lib/bx/seq/__init__.py)
___________________ ERROR collecting lib/bx/seq/seq_tests.py ___________________
ImportError while importing test module '/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0/lib/bx/seq/seq_tests.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../../../../../usr/lib/python3.12/site-packages/_pytest/python.py:492: in importtestmodule
    mod = import_path(
../../../../../../../usr/lib/python3.12/site-packages/_pytest/pathlib.py:591: in import_path
    importlib.import_module(module_name)
../../../../../../../usr/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1310: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:995: in exec_module
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
lib/bx/seq/__init__.py:7: in <module>
    from bx.seq.core import *  # noqa: F40
lib/bx/seq/core.py:11: in <module>
    from . import (
lib/bx/seq/nib.py:30: in <module>
    from . import _nib
E   ImportError: cannot import name '_nib' from partially initialized module 'bx.seq' (most likely due to a circular import) (/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0/lib/bx/seq/__init__.py)
_________________ ERROR collecting lib/bx/seq/twobit_tests.py __________________
ImportError while importing test module '/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0/lib/bx/seq/twobit_tests.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../../../../../usr/lib/python3.12/site-packages/_pytest/python.py:492: in importtestmodule
    mod = import_path(
../../../../../../../usr/lib/python3.12/site-packages/_pytest/pathlib.py:591: in import_path
    importlib.import_module(module_name)
../../../../../../../usr/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1310: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
<frozen importlib._bootstrap_external>:995: in exec_module
    ???
<frozen importlib._bootstrap>:488: in _call_with_frames_removed
    ???
lib/bx/seq/__init__.py:7: in <module>
    from bx.seq.core import *  # noqa: F40
lib/bx/seq/core.py:11: in <module>
    from . import (
lib/bx/seq/nib.py:30: in <module>
    from . import _nib
E   ImportError: cannot import name '_nib' from partially initialized module 'bx.seq' (most likely due to a circular import) (/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0/lib/bx/seq/__init__.py)
_________________ ERROR collecting lib/bx/seqmapping_tests.py __________________
ImportError while importing test module '/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0/lib/bx/seqmapping_tests.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../../../../../usr/lib/python3.12/site-packages/_pytest/python.py:492: in importtestmodule
    mod = import_path(
../../../../../../../usr/lib/python3.12/site-packages/_pytest/pathlib.py:591: in import_path
    importlib.import_module(module_name)
../../../../../../../usr/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1387: in _gcd_import
    ???
<frozen importlib._bootstrap>:1360: in _find_and_load
    ???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:935: in _load_unlocked
    ???
../../../../../../../usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
lib/bx/seqmapping_tests.py:13: in <module>
    import bx.seqmapping
lib/bx/seqmapping.py:31: in <module>
    from ._seqmapping import (
E   ModuleNotFoundError: No module named 'bx._seqmapping'
=============================== warnings summary ===============================
lib/bx_extras/pyparsing.py:65
  /my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0/lib/bx_extras/pyparsing.py:65: DeprecationWarning: module 'sre_constants' is deprecated
    import sre_constants

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
ERROR lib/bx/align/epo_tests.py
ERROR lib/bx/align/lav_tests.py
ERROR lib/bx/align/sitemask/sitemask_tests.py
ERROR lib/bx/arrays/array_tree_tests.py
ERROR lib/bx/bbi/bigwig_tests.py
ERROR lib/bx/bitset_tests.py
ERROR lib/bx/intervals/cluster_tests.py
ERROR lib/bx/intervals/intersection_tests.py
ERROR lib/bx/misc/bgzf_tests.py
ERROR lib/bx/misc/seekbzip2_tests.py
ERROR lib/bx/motif/io/transfac_tests.py
ERROR lib/bx/motif/pwm_tests.py
ERROR lib/bx/seq/fasta_tests.py
ERROR lib/bx/seq/nib_tests.py
ERROR lib/bx/seq/qdna_tests.py
ERROR lib/bx/seq/seq_tests.py
ERROR lib/bx/seq/twobit_tests.py
ERROR lib/bx/seqmapping_tests.py
!!!!!!!!!!!!!!!!!!! Interrupted: 18 errors during collection !!!!!!!!!!!!!!!!!!!
======================== 1 warning, 18 errors in 1.93s =========================
 * ERROR: sci-biology/bx-python-0.12.0::science failed (test phase):
 *   pytest failed with python3.12
 * 
 * Call stack:
 *     ebuild.sh, line  136:  Called src_test
 *   environment, line 3896:  Called distutils-r1_src_test
 *   environment, line 1948:  Called _distutils-r1_run_foreach_impl 'python_test'
 *   environment, line  745:  Called python_foreach_impl 'distutils-r1_run_phase' 'python_test'
 *   environment, line 3501:  Called multibuild_foreach_variant '_python_multibuild_wrapper' 'distutils-r1_run_phase' 'python_test'
 *   environment, line 3058:  Called _multibuild_run '_python_multibuild_wrapper' 'distutils-r1_run_phase' 'python_test'
 *   environment, line 3056:  Called _python_multibuild_wrapper 'distutils-r1_run_phase' 'python_test'
 *   environment, line 1194:  Called distutils-r1_run_phase 'python_test'
 *   environment, line 1871:  Called python_test
 *   environment, line 3783:  Called distutils-r1_python_test
 *   environment, line 1809:  Called epytest
 *   environment, line 2485:  Called die
 * The specific snippet of code:
 *       [[ ${ret} -ne 0 ]] && die -n "pytest failed with ${EPYTHON}";
 * 
 * If you need support, post the output of `emerge --info '=sci-biology/bx-python-0.12.0::science'`,
 * the complete build log and the output of `emerge -pqv '=sci-biology/bx-python-0.12.0::science'`.
 * The complete build log is located at '/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/temp/build.log'.
 * The ebuild environment file is located at '/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/temp/environment'.
 * Working directory: '/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0'
 * S: '/my_dir/var/tmp/portage/sci-biology/bx-python-0.12.0/work/bx-python-0.12.0'
@nsoranzo
Copy link
Collaborator

Thanks for reporting the issue!
@mr-c Maybe you have suggestions from the Debian packaging?

@mschubert
Copy link
Author

The issue here seems to be that -m gpep517 (at least in Gentoo ebuilds) does not allow in-source builds. The pytest.ini and test_data are in the sources, while the compiled (or installed) package is in a separate directory.

I could get most tests to run by linking pytest.ini and test_data into the built directory and calling pytest from there.

Now, only the following two fail:

lib.linux-x86_64-cpython-312/bx/binned_array_tests.py::test_file_lzo
lib.linux-x86_64-cpython-312/bx/binned_array_tests.py::test_binned_array_writer

both with:

compress = comp_types[comp_type][0]
E       KeyError: 'lzo'

@nsoranzo
Copy link
Collaborator

I could get most tests to run by linking pytest.ini and test_data into the built directory and calling pytest from there.

That's good progress, thanks for your work on that!

Now, only the following two fail:

lib.linux-x86_64-cpython-312/bx/binned_array_tests.py::test_file_lzo
lib.linux-x86_64-cpython-312/bx/binned_array_tests.py::test_binned_array_writer

both with:

compress = comp_types[comp_type][0]
E       KeyError: 'lzo'

That's likely due to missing python-lzo, which is not strictly required by bx-python but it's need for these tests to pass, see https://github.com/bxlab/bx-python/blob/main/tox.ini#L16

@mschubert mschubert changed the title Errors while collecting tests from locally compiled+installed wheel (gentoo build) Tests do not run in PEP517 out-of-source build (gentoo) Jul 18, 2024
@mschubert
Copy link
Author

Oh yes, that makes sense. Thank you!

I edited the title for the PEP517 tests, please feel free to leave open or close as you prefer.

@nsoranzo
Copy link
Collaborator

nsoranzo commented Aug 2, 2024

@mschubert Sorry for late reply here, if there's anything that we can do here that would make your life easier let us know!

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