Skip to content

Tests fail if not 'codespell' installed #3433

Open
@anatol

Description

@anatol

It looks like the project tests use codespell from $PATH rather than from the source tree.

I am following Arch linux build instructions. I build the project with python -m build --wheel --no-isolation then run tests with pytest and it fails:

$ pytest
=============================================================================================== test session starts ===============================================================================================
platform linux -- Python 3.12.3, pytest-8.2.1, pluggy-1.5.0
rootdir: /storage/sources/codespell
configfile: pyproject.toml
testpaths: codespell_lib/tests
plugins: dependency-0.6.0, cov-4.1.0, typeguard-4.2.1
collected 113 items                                                                                                                                                                                               

codespell_lib/tests/test_basic.py .F........................................................F                                                                                                               [ 52%]
codespell_lib/tests/test_dictionary.py ..............................ssssssssssssssss........                                                                                                               [100%]

==================================================================================================== FAILURES =====================================================================================================
__________________________________________________________________________________________________ test_command ___________________________________________________________________________________________________
codespell_lib/tests/test_basic.py:85: in test_command
    assert run_codespell(cwd=tmp_path) == 0
codespell_lib/tests/test_basic.py:72: in run_codespell
    proc = subprocess.run(
/usr/lib/python3.12/subprocess.py:548: in run
    with Popen(*popenargs, **kwargs) as process:
/usr/lib/python3.12/subprocess.py:1026: in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
/usr/lib/python3.12/subprocess.py:1955: in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
E   FileNotFoundError: [Errno 2] No such file or directory: 'codespell'
___________________________________________________________________________________________________ test_stdin ____________________________________________________________________________________________________
codespell_lib/tests/test_basic.py:1367: in test_stdin
    assert run_codespell_stdin(
codespell_lib/tests/test_basic.py:1342: in run_codespell_stdin
    proc = subprocess.run(
/usr/lib/python3.12/subprocess.py:548: in run
    with Popen(*popenargs, **kwargs) as process:
/usr/lib/python3.12/subprocess.py:1026: in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
/usr/lib/python3.12/subprocess.py:1955: in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
E   FileNotFoundError: [Errno 2] No such file or directory: 'codespell'
------------------------------------------------------------------------ generated xml file: /storage/sources/codespell/junit-results.xml -------------------------------------------------------------------------
============================================================================================= short test summary info =============================================================================================
SKIPPED [16] codespell_lib/tests/test_dictionary.py:223: requires aspell-en
==================================================================================== 2 failed, 95 passed, 16 skipped in 56.63s ====================================================================================

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions