Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Trouble getting tests running

未关闭
#51 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
python
领域
testing

调研方向

先查看 README.rst 中的安装和环境变量指南,然后重现报告的 pytest 收集失败。检查 src/extractcode/libarchive2.py 第 635 行附近的内容,以及 tests/test_archive.py 和 tests/test_extract.py 中的导入;当测试套件能够在不出现报告的 archive_read_new 错误的情况下完成收集时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

Hello,

I can't seem to manage to get extractcode and typecode to run the tests.

The whole issue is that part of the README.rst:

To install this package with its full capability (where the binaries for
7zip and libarchive are installed), use the full extra option::

pip install extractcode[full]

If you want to use the version of binaries (possibly) provided by your operating
system, use the minimal option::

pip install extractcode

In this case, you will need to provide a working and compatible libarchive and
7zip installed and configured in one of these ways such that ExtractCode can
find them:

So I am on a distro with libarchive-3.7.1 and p7zip-16.02 installed. Obviously I don't want to bundle with the full option.

I set up:

export EXTRACTCODE_7Z_PATH=%{_bindir}
export EXTRACTCODE_LIBARCHIVE_PATH_ENVVAR=%{_libdir}
%pytest

It seems that libarchive is detected:

=============================== warnings summary ===============================
../../../../usr/lib/python3.12/site-packages/typecode/magic2.py:195
  /usr/lib/python3.12/site-packages/typecode/magic2.py:195: UserWarning: System libmagic found in typical location is used. Install instead a typecode-libmagic plugin for best support.
    warnings.warn(

src/extractcode/libarchive2.py:107: 12 warnings
  /builddir/build/BUILD/extractcode-31.0.0/src/extractcode/libarchive2.py:107: UserWarning: Using "libarchive" library found in a system location. Install instead a extractcode-libarchive plugin for best support.
    warnings.warn(

(same with libmagic)

However nothing works:

==================================== ERRORS ====================================
_________________ ERROR collecting src/extractcode/archive.py __________________
src/extractcode/archive.py:29: in <module>
    from extractcode import libarchive2
<frozen importlib._bootstrap>:1266: in _find_and_load
    ???
<frozen importlib._bootstrap>:1237: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:841: in _load_unlocked
    ???
/usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
src/extractcode/libarchive2.py:635: in <module>
    archive_reader = libarchive.archive_read_new
/usr/lib64/python3.12/ctypes/__init__.py:392: in __getattr__
    func = self.__getitem__(name)
/usr/lib64/python3.12/ctypes/__init__.py:397: in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
E   AttributeError: /usr/bin/python3: undefined symbol: archive_read_new
_________________ ERROR collecting src/extractcode/archive.py __________________
src/extractcode/archive.py:29: in <module>
    from extractcode import libarchive2
<frozen importlib._bootstrap>:1266: in _find_and_load
    ???
<frozen importlib._bootstrap>:1237: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:841: in _load_unlocked
    ???
/usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
src/extractcode/libarchive2.py:635: in <module>
    archive_reader = libarchive.archive_read_new
/usr/lib64/python3.12/ctypes/__init__.py:392: in __getattr__
    func = self.__getitem__(name)
/usr/lib64/python3.12/ctypes/__init__.py:397: in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
E   AttributeError: /usr/bin/python3: undefined symbol: archive_read_new
_________________ ERROR collecting src/extractcode/extract.py __________________
src/extractcode/extract.py:23: in <module>
    import extractcode.archive
<frozen importlib._bootstrap>:1266: in _find_and_load
    ???
<frozen importlib._bootstrap>:1237: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:841: in _load_unlocked
    ???
/usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
src/extractcode/archive.py:29: in <module>
    from extractcode import libarchive2
<frozen importlib._bootstrap>:1266: in _find_and_load
    ???
<frozen importlib._bootstrap>:1237: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:841: in _load_unlocked
    ???
/usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
src/extractcode/libarchive2.py:635: in <module>
    archive_reader = libarchive.archive_read_new
/usr/lib64/python3.12/ctypes/__init__.py:392: in __getattr__
    func = self.__getitem__(name)
/usr/lib64/python3.12/ctypes/__init__.py:397: in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
E   AttributeError: /usr/bin/python3: undefined symbol: archive_read_new
_________________ ERROR collecting src/extractcode/extract.py __________________
src/extractcode/extract.py:23: in <module>
    import extractcode.archive
<frozen importlib._bootstrap>:1266: in _find_and_load
    ???
<frozen importlib._bootstrap>:1237: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:841: in _load_unlocked
    ???
/usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
src/extractcode/archive.py:29: in <module>
    from extractcode import libarchive2
<frozen importlib._bootstrap>:1266: in _find_and_load
    ???
<frozen importlib._bootstrap>:1237: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:841: in _load_unlocked
    ???
/usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
src/extractcode/libarchive2.py:635: in <module>
    archive_reader = libarchive.archive_read_new
/usr/lib64/python3.12/ctypes/__init__.py:392: in __getattr__
    func = self.__getitem__(name)
/usr/lib64/python3.12/ctypes/__init__.py:397: in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
E   AttributeError: /usr/bin/python3: undefined symbol: archive_read_new
_______________ ERROR collecting src/extractcode/libarchive2.py ________________
src/extractcode/libarchive2.py:635: in <module>
    archive_reader = libarchive.archive_read_new
/usr/lib64/python3.12/ctypes/__init__.py:392: in __getattr__
    func = self.__getitem__(name)
/usr/lib64/python3.12/ctypes/__init__.py:397: in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
E   AttributeError: /usr/bin/python3: undefined symbol: archive_read_new
_______________ ERROR collecting src/extractcode/libarchive2.py ________________
src/extractcode/libarchive2.py:635: in <module>
    archive_reader = libarchive.archive_read_new
/usr/lib64/python3.12/ctypes/__init__.py:392: in __getattr__
    func = self.__getitem__(name)
/usr/lib64/python3.12/ctypes/__init__.py:397: in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
E   AttributeError: /usr/bin/python3: undefined symbol: archive_read_new
____________________ ERROR collecting tests/test_archive.py ____________________
tests/test_archive.py:29: in <module>
    from extractcode import archive
<frozen importlib._bootstrap>:1266: in _find_and_load
    ???
<frozen importlib._bootstrap>:1237: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:841: in _load_unlocked
    ???
/usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
src/extractcode/archive.py:29: in <module>
    from extractcode import libarchive2
<frozen importlib._bootstrap>:1266: in _find_and_load
    ???
<frozen importlib._bootstrap>:1237: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:841: in _load_unlocked
    ???
/usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
src/extractcode/libarchive2.py:635: in <module>
    archive_reader = libarchive.archive_read_new
/usr/lib64/python3.12/ctypes/__init__.py:392: in __getattr__
    func = self.__getitem__(name)
/usr/lib64/python3.12/ctypes/__init__.py:397: in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
E   AttributeError: /usr/bin/python3: undefined symbol: archive_read_new
____________________ ERROR collecting tests/test_archive.py ____________________
tests/test_archive.py:29: in <module>
    from extractcode import archive
<frozen importlib._bootstrap>:1266: in _find_and_load
    ???
<frozen importlib._bootstrap>:1237: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:841: in _load_unlocked
    ???
/usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
src/extractcode/archive.py:29: in <module>
    from extractcode import libarchive2
<frozen importlib._bootstrap>:1266: in _find_and_load
    ???
<frozen importlib._bootstrap>:1237: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:841: in _load_unlocked
    ???
/usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
src/extractcode/libarchive2.py:635: in <module>
    archive_reader = libarchive.archive_read_new
/usr/lib64/python3.12/ctypes/__init__.py:392: in __getattr__
    func = self.__getitem__(name)
/usr/lib64/python3.12/ctypes/__init__.py:397: in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
E   AttributeError: /usr/bin/python3: undefined symbol: archive_read_new
____________________ ERROR collecting tests/test_extract.py ____________________
tests/test_extract.py:23: in <module>
    from extractcode import extract
<frozen importlib._bootstrap>:1266: in _find_and_load
    ???
<frozen importlib._bootstrap>:1237: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:841: in _load_unlocked
    ???
/usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
src/extractcode/extract.py:23: in <module>
    import extractcode.archive
<frozen importlib._bootstrap>:1266: in _find_and_load
    ???
<frozen importlib._bootstrap>:1237: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:841: in _load_unlocked
    ???
/usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
src/extractcode/archive.py:29: in <module>
    from extractcode import libarchive2
<frozen importlib._bootstrap>:1266: in _find_and_load
    ???
<frozen importlib._bootstrap>:1237: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:841: in _load_unlocked
    ???
/usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
src/extractcode/libarchive2.py:635: in <module>
    archive_reader = libarchive.archive_read_new
/usr/lib64/python3.12/ctypes/__init__.py:392: in __getattr__
    func = self.__getitem__(name)
/usr/lib64/python3.12/ctypes/__init__.py:397: in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
E   AttributeError: /usr/bin/python3: undefined symbol: archive_read_new
____________________ ERROR collecting tests/test_extract.py ____________________
tests/test_extract.py:23: in <module>
    from extractcode import extract
<frozen importlib._bootstrap>:1266: in _find_and_load
    ???
<frozen importlib._bootstrap>:1237: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:841: in _load_unlocked
    ???
/usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
src/extractcode/extract.py:23: in <module>
    import extractcode.archive
<frozen importlib._bootstrap>:1266: in _find_and_load
    ???
<frozen importlib._bootstrap>:1237: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:841: in _load_unlocked
    ???
/usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
src/extractcode/archive.py:29: in <module>
    from extractcode import libarchive2
<frozen importlib._bootstrap>:1266: in _find_and_load
    ???
<frozen importlib._bootstrap>:1237: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:841: in _load_unlocked
    ???
/usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
src/extractcode/libarchive2.py:635: in <module>
    archive_reader = libarchive.archive_read_new
/usr/lib64/python3.12/ctypes/__init__.py:392: in __getattr__
    func = self.__getitem__(name)
/usr/lib64/python3.12/ctypes/__init__.py:397: in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
E   AttributeError: /usr/bin/python3: undefined symbol: archive_read_new
________________ ERROR collecting tests/test_extractcode_api.py ________________
tests/test_extractcode_api.py:16: in <module>
    from extractcode import extract
<frozen importlib._bootstrap>:1266: in _find_and_load
    ???
<frozen importlib._bootstrap>:1237: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:841: in _load_unlocked
    ???
/usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
src/extractcode/extract.py:23: in <module>
    import extractcode.archive
<frozen importlib._bootstrap>:1266: in _find_and_load
    ???
<frozen importlib._bootstrap>:1237: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:841: in _load_unlocked
    ???
/usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
src/extractcode/archive.py:29: in <module>
    from extractcode import libarchive2
<frozen importlib._bootstrap>:1266: in _find_and_load
    ???
<frozen importlib._bootstrap>:1237: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:841: in _load_unlocked
    ???
/usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
src/extractcode/libarchive2.py:635: in <module>
    archive_reader = libarchive.archive_read_new
/usr/lib64/python3.12/ctypes/__init__.py:392: in __getattr__
    func = self.__getitem__(name)
/usr/lib64/python3.12/ctypes/__init__.py:397: in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
E   AttributeError: /usr/bin/python3: undefined symbol: archive_read_new
________________ ERROR collecting tests/test_extractcode_api.py ________________
tests/test_extractcode_api.py:16: in <module>
    from extractcode import extract
<frozen importlib._bootstrap>:1266: in _find_and_load
    ???
<frozen importlib._bootstrap>:1237: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:841: in _load_unlocked
    ???
/usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
src/extractcode/extract.py:23: in <module>
    import extractcode.archive
<frozen importlib._bootstrap>:1266: in _find_and_load
    ???
<frozen importlib._bootstrap>:1237: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:841: in _load_unlocked
    ???
/usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
src/extractcode/archive.py:29: in <module>
    from extractcode import libarchive2
<frozen importlib._bootstrap>:1266: in _find_and_load
    ???
<frozen importlib._bootstrap>:1237: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:841: in _load_unlocked
    ???
/usr/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
src/extractcode/libarchive2.py:635: in <module>
    archive_reader = libarchive.archive_read_new
/usr/lib64/python3.12/ctypes/__init__.py:392: in __getattr__
    func = self.__getitem__(name)
/usr/lib64/python3.12/ctypes/__init__.py:397: in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
E   AttributeError: /usr/bin/python3: undefined symbol: archive_read_new

archive_read_new is not found so it doesn't find libarchive I believe.

So I may not have understood the README.rst correctly. Are all the part s following "In this case, you will need to provide a working and compatible libarchive and 7zip installed and configured in one of these ways such that ExtractCode can find them:" mandatory or do I have to choose among the options?

Are the plugins mandatory?

Then If I distribute extractool, does the user have to set up EXTRACTCODE_7Z_PATH and EXTRACTCODE_7Z_PATH each time? Is there a way to avoir that without bundling?

主要语言
Python
星标
39
派生
23
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

aboutcode-org/extractcode 的其他 Issue

查看 aboutcode-org/extractcode 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。