Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

2.0.0: pytest is failing in tests/runners.py units

Open
#933 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
python
Domain
cli, testing

Research direction

Start with the offline PEP517 build and pytest command reported in the issue, then inspect the first full ThreadException from tests/runners.py rather than the aggregate failure list. Trace the shared failure affecting the runner tests and verify that the relevant tests pass in the same non-root, network-disabled environment.

Written by the indexing model from the issue text.

Description

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

  • 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>
  • 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-invoke-2.0.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-invoke-2.0.0-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.16, pytest-7.3.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/invoke-2.0.0
configfile: pytest.ini
testpaths: tests
plugins: relaxed-2.0.0
collected 980 items

tests/cli.py ......................                                      [  2%]
tests/collection.py .................................................... [  7%]
......................................                                   [ 11%]
tests/completion.py .........................                            [ 13%]
tests/concurrency.py ......                                              [ 14%]
tests/config.py ........................................................ [ 20%]
............................................................             [ 26%]
tests/context.py .................................s.s................... [ 32%]
...........................                                              [ 34%]
tests/executor.py .....................................                  [ 38%]
tests/init.py ............................                               [ 41%]
tests/loader.py ...............                                          [ 42%]
tests/merge_dicts.py ............                                        [ 44%]
tests/parser_argument.py ..................s...................          [ 48%]
tests/parser_context.py .............................................    [ 52%]
tests/parser_parser.py ................................................. [ 57%]
...........                                                              [ 58%]
tests/program.py ....................................................... [ 64%]
...ss..............................................................      [ 71%]
tests/runners.py ....FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF..FFs..FFFFFFFF [ 76%]
..FFFFFFFFFFFF........FF..FFFFFFFsFFFFFFFFFFFFFFFFFFF.........F.FFFFF.FF [ 84%]
FFF............FFFFFs.FFFFFF.FF.F..F.........................            [ 90%]
tests/task.py ......s................................................... [ 96%]
..............                                                           [ 97%]
tests/terminals.py ......ss                                              [ 98%]
tests/util.py .......                                                    [ 99%]
tests/watchers.py .......                                                [100%]

=================================== FAILURES ===================================

[..]

================================================================================== short test summary info ==================================================================================
SKIPPED [1] tests/context.py:330: Skipped
SKIPPED [1] tests/context.py:350: Skipped
SKIPPED [1] tests/parser_argument.py:95: Skipped
SKIPPED [1] tests/program.py:530: Skipped
SKIPPED [1] tests/program.py:533: Skipped
SKIPPED [1] tests/runners.py:400: Skipped
SKIPPED [1] tests/runners.py:836: Skipped
SKIPPED [1] tests/runners.py:1586: Skipped
SKIPPED [1] tests/task.py:57: Skipped
SKIPPED [1] tests/terminals.py:75: Skipped
SKIPPED [1] tests/terminals.py:78: Skipped
FAILED tests/runners.py::Runner_::warn::honors_config - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::warn::kwarg_beats_config - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::warn::does_not_apply_to_watcher_errors - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::warn::does_not_apply_to_timeout_errors - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::hide::honors_config - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::hide::kwarg_beats_config - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::pty::pty_defaults_to_off - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::pty::honors_config - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::pty::kwarg_beats_config - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::shell::defaults_to_bash_or_cmdexe_when_pty_True - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::shell::defaults_to_bash_or_cmdexe_when_pty_False - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::shell::may_be_overridden - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::shell::may_be_configured - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::shell::kwarg_beats_config - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::env::defaults_to_os_environ - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::env::updates_when_dict_given - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::env::replaces_when_replace_env_True - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::env::config_can_be_used - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::env::kwarg_wins_over_config - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::return_value::return_code - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::return_value::ok_attr_indicates_success - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::return_value::ok_attr_indicates_failure - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::return_value::failed_attr_indicates_success - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::return_value::failed_attr_indicates_failure - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::return_value::stdout_attribute_contains_stdout - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::return_value::stderr_attribute_contains_stderr - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::return_value::whether_pty_was_used - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::return_value::command_executed - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::return_value::shell_used - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::return_value::hide_param_exposed_and_normalized - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::command_echoing::off_by_default - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::command_echoing::enabled_via_kwarg - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::command_echoing::enabled_via_config - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::command_echoing::kwarg_beats_config - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::command_echoing::uses_ansi_bold - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::command_echoing::uses_custom_format - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::encoding::defaults_to_encoding_method_result - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::encoding::honors_config - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::output_hiding::both_hides_everything - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::output_hiding::True_hides_everything - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::output_hiding::out_only_hides_stdout - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::output_hiding::err_only_hides_stderr - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::output_hiding::accepts_stdout_alias_for_out - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::output_hiding::accepts_stderr_alias_for_err - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::output_hiding::None_hides_nothing - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::output_hiding::False_hides_nothing - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::output_hiding::does_not_affect_capturing - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::output_hiding::overrides_echoing - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::output_stream_overrides::out_defaults_to_sys_stdout - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::output_stream_overrides::err_defaults_to_sys_stderr - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::output_stream_overrides::out_can_be_overridden - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::output_stream_overrides::overridden_out_is_never_hidden - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::output_stream_overrides::err_can_be_overridden - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::output_stream_overrides::overridden_err_is_never_hidden - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::output_stream_overrides::pty_defaults_to_sys - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::output_stream_overrides::pty_out_can_be_overridden - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::output_stream_handling::writes_and_flushes_to_stdout - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::output_stream_handling::writes_and_flushes_to_stderr - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::failure_handling::fast_failures - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::failure_handling::non_1_return_codes_still_act_as_failure - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::failure_handling::UnexpectedExit_repr::similar_to_just_the_result_repr - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::failure_handling::UnexpectedExit_str::displays_command_and_exit_code_by_default - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::failure_handling::UnexpectedExit_str::does_not_display_stderr_when_pty_True - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::failure_handling::UnexpectedExit_str::pty_stderr_message_wins_over_hidden_stderr - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::failure_handling::UnexpectedExit_str::explicit_hidden_stream_tail_display - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::failure_handling::UnexpectedExit_str::displays_tails_of_streams_only_when_hidden - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::failure_handling::reason::is_None_for_regular_nonzero_exits - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::failure_handling::reason::is_exception_when_WatcherError_raised_internally - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::failure_handling::wrapped_result::most_attrs_are_always_present - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::failure_handling::wrapped_result::shell_exit_failure::exited_is_integer - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::failure_handling::wrapped_result::shell_exit_failure::ok_bool_etc_are_falsey - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::failure_handling::wrapped_result::shell_exit_failure::stringrep_notes_exit_status - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::failure_handling::wrapped_result::watcher_failure::exited_is_None - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::failure_handling::wrapped_result::watcher_failure::ok_and_bool_still_are_falsey - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::failure_handling::wrapped_result::watcher_failure::stringrep_lacks_exit_status - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::threading::errors_within_io_thread_body_bubble_up - AssertionError: assert 3 == 2
FAILED tests/runners.py::Runner_::threading::io_thread_errors_str_has_details - assert 'Saw 1 exceptions within threads' in "\nSaw 2 exceptions within threads (OhNoz, OSError):\n\n\nThread args: {'kwargs': {'buffer_': [],\n            'hide':...in read\n    raise ...
FAILED tests/runners.py::Runner_::watchers::nothing_is_written_to_stdin_by_default - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::watchers::watchers_responses_get_written_to_proc_stdin - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::watchers::multiple_hits_yields_multiple_responses - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::watchers::chunk_sizes_smaller_than_patterns_still_work_ok - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::watchers::both_out_and_err_are_scanned - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::watchers::multiple_patterns_works_as_expected - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::watchers::multiple_patterns_across_both_streams - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::watchers::honors_watchers_config_option - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::watchers::kwarg_overrides_config - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::character_buffered_stdin::setcbreak_called_on_tty_stdins - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::character_buffered_stdin::setcbreak_not_called_if_process_not_foregrounded - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::character_buffered_stdin::tty_stdins_have_settings_restored_by_default - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::character_buffered_stdin::tty_stdins_have_settings_restored_on_KeyboardInterrupt - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::character_buffered_stdin::setcbreak_not_called_if_terminal_seems_already_cbroken - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::send_interrupt::called_on_KeyboardInterrupt - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::send_interrupt::sends_escape_byte_sequence - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::timeout::start_timer_called_with_config_value - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::timeout::run_kwarg_honored - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::timeout::kwarg_wins_over_config - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Runner_::timeout::raises_CommandTimedOut_with_timeout_info - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Local_::pty::when_pty_True_we_use_pty_fork_and_os_exec - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Local_::pty::pty_uses_WEXITSTATUS_if_WIFEXITED - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Local_::pty::pty_uses_WTERMSIG_if_WIFSIGNALED - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Local_::pty::WTERMSIG_result_turned_negative_to_match_subprocess - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Local_::pty::pty_is_set_to_controlling_terminal_size - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Local_::pty::spurious_OSErrors_handled_gracefully - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Local_::pty::other_spurious_OSErrors_handled_gracefully - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Local_::pty::non_spurious_OSErrors_bubble_up - AssertionError: assert <class 'KeyError'> == OSError
FAILED tests/runners.py::Local_::pty::stop_mutes_errors_on_pty_close - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Local_::pty::fallback::can_be_overridden_by_kwarg - OSError: [Errno 25] Inappropriate ioctl for device
FAILED tests/runners.py::Local_::pty::fallback::can_be_overridden_by_config - OSError: [Errno 25] Inappropriate ioctl for device
FAILED tests/runners.py::Local_::pty::fallback::overridden_fallback_affects_result_pty_value - OSError: [Errno 25] Inappropriate ioctl for device
FAILED tests/runners.py::Local_::shell::defaults_to_bash_or_cmdexe_when_pty_True - invoke.exceptions.ThreadException:
FAILED tests/runners.py::Local_::shell::may_be_overridden_when_pty_True - FileNotFoundError: [Errno 2] No such file or directory: '/bin/zsh'
FAILED tests/runners.py::Local_::env::uses_execve_for_pty_True - invoke.exceptions.ThreadException:
================================================================ 112 failed, 857 passed, 11 skipped, 402 warnings in 15.81s =================================================================

Full pytest output is in attachment python-invoke-pytest.txt

Here is list of installed modules in build env

Package         Version
--------------- -------
asttokens       2.2.1
build           0.10.0
colorama        0.4.6
decorator       5.1.1
distro          1.8.0
exceptiongroup  1.0.0
executing       1.2.0
fluidity-sm     0.2.0
gpg             1.19.0
icecream        2.1.3
iniconfig       2.0.0
installer       0.7.0
lexicon         2.0.1
libcomps        0.1.19
packaging       23.0
pluggy          1.0.0
Pygments        2.15.0
pyproject_hooks 1.0.0
pytest          7.3.0
pytest-relaxed  2.0.0
python-dateutil 2.8.2
PyYAML          6.0
setuptools      65.6.3
six             1.16.0
tomli           2.0.1
wheel           0.40.0
Dominant language
Python
Stars
4.8k
Forks
412
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pyinvoke/invoke

All issues in pyinvoke/invoke

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.