tmux-python/libtmux

Tests failing on armv7l

johanneskastl opened this issue · 3 comments

I am packaging libtmux for openSUSE. Unfortunately the tests fail on armv7l:

[   63s] =================================== FAILURES ===================================
[   63s] ______________________________ test_capture_pane _______________________________
[   63s] 
[   63s] session = Session($1 libtmux_xqmt86pw)
[   63s] 
[   63s]     def test_capture_pane(session: Session) -> None:
[   63s]         env = shutil.which("env")
[   63s]         assert env is not None, "Cannot find usable `env` in PATH."
[   63s]     
[   63s]         session.new_window(
[   63s]             attach=True,
[   63s]             window_name="capture_pane",
[   63s]             window_shell=f"{env} PS1='$ ' sh",
[   63s]         )
[   63s]         pane = session.attached_window.attached_pane
[   63s]         assert pane is not None
[   63s]         pane_contents = "\n".join(pane.capture_pane())
[   63s]         assert pane_contents == "$"
[   63s]         pane.send_keys(
[   63s]             r'printf "\n%s\n" "Hello World !"', literal=True, suppress_history=False
[   63s]         )
[   63s]         pane_contents = "\n".join(pane.capture_pane())
[   63s] >       assert pane_contents == r'$ printf "\n%s\n" "Hello World !"{}'.format(
[   63s]             "\n\nHello World !\n$"
[   63s]         )
[   63s] E       assert '$ printf "\\...ello World !"' == '$ printf "\\...lo World !\n$'
[   63s] E         - $ printf "\n%s\n" "Hello World !"
[   63s] E         ?                                  -
[   63s] E         + $ printf "\n%s\n" "Hello World !"
[   63s] E         - 
[   63s] E         - Hello World !
[   63s] E         - $
[   63s] 
[   63s] tests/legacy_api/test_pane.py:86: AssertionError

And another one:

[   81s] =================================== FAILURES ===================================
[   81s] ______________________________ test_select_window ______________________________
[   81s] 
[   81s] session = Session($1 libtmux_7ruy1pqh)
[   81s] 
[   81s]     def test_select_window(session: Session) -> None:
[   81s]         """Session.select_window moves window."""
[   81s]         # get the current window_base_index, since different user tmux config
[   81s]         # may start at 0 or 1, or whatever they want.
[   81s]         window_idx = session.attached_window.window_index
[   81s]         assert window_idx is not None
[   81s]         window_base_index = int(window_idx)
[   81s]     
[   81s]         session.new_window(window_name="test_window")
[   81s]         window_count = len(session.windows)
[   81s]     
[   81s]         assert window_count >= 2  # 2 or more windows
[   81s]     
[   81s]         assert len(session.windows) == window_count
[   81s]     
[   81s]         # tmux selects a window, moves to it, shows it as attached_window
[   81s]         selected_window1 = session.select_window(window_base_index)
[   81s]         assert isinstance(selected_window1, Window)
[   81s]         attached_window1 = session.attached_window
[   81s]     
[   81s]         assert selected_window1 == attached_window1
[   81s] >       assert selected_window1.__dict__ == attached_window1.__dict__
[   81s] E       AssertionError: assert {'active_wind...e': None, ...} == {'active_wind...e': None, ...}
[   81s] E         Omitting 120 identical items, use -vv to show
[   81s] E         Differing items:
[   81s] E         {'cursor_x': '0'} != {'cursor_x': '62'}
[   81s] E         {'history_bytes': '576'} != {'history_bytes': '976'}
[   81s] E         Full diff:
[   81s] E           {
[   81s] E            'active_window_index': '1',...
[   81s] E         
[   81s] E         ...Full output truncated (129 lines hidden), use '-vv' to show
[   81s] 
[   81s] tests/test_session.py:51: AssertionError
[   81s] =============================== warnings summary ===============================
[...]

And two more:

[   79s] =================================== FAILURES ===================================
[   79s] ___________________________ test_function_times_out ____________________________
[   79s] 
[   79s]     def test_function_times_out() -> None:
[   79s]         ini = time()
[   79s]     
[   79s]         def never_true() -> bool:
[   79s]             return False
[   79s]     
[   79s]         with pytest.raises(WaitTimeout):
[   79s]             retry_until(never_true, 1)
[   79s]     
[   79s]         end = time()
[   79s]     
[   79s] >       assert abs((end - ini) - 1.0) < 0.01
[   79s] E       assert 0.010026931762695312 < 0.01
[   79s] E        +  where 0.010026931762695312 = abs(((1679552160.754546 - 1679552159.744519) - 1.0))
[   79s] 
[   79s] tests/legacy_api/test_test.py:41: AssertionError
[   79s] _______________________ test_function_times_out_no_rise ________________________
[   79s] 
[   79s]     def test_function_times_out_no_rise() -> None:
[   79s]         ini = time()
[   79s]     
[   79s]         def never_true() -> bool:
[   79s]             return False
[   79s]     
[   79s]         retry_until(never_true, 1, raises=False)
[   79s]     
[   79s]         end = time()
[   79s]     
[   79s] >       assert abs((end - ini) - 1.0) < 0.01
[   79s] E       assert 0.016624927520751953 < 0.01
[   79s] E        +  where 0.016624927520751953 = abs(((1679552161.8158545 - 1679552160.7992296) - 1.0))
[   79s] 
[   79s] tests/legacy_api/test_test.py:54: AssertionError
[   79s] =============================== warnings summary ===============================

And the next one:

[   84s] =================================== FAILURES ===================================
[   84s] ________________ test_new_window_with_environment[environment0] ________________
[   84s] 
[   84s] session = Session($1 libtmux_x82y4wzk), environment = {'ENV_VAR': 'window'}
[   84s] 
[   84s]     @pytest.mark.skipif(
[   84s]         has_lt_version("3.0"),
[   84s]         reason="needs -e flag for new-window which was introduced in 3.0",
[   84s]     )
[   84s]     @pytest.mark.parametrize(
[   84s]         "environment",
[   84s]         [
[   84s]             {"ENV_VAR": "window"},
[   84s]             {"ENV_VAR_1": "window_1", "ENV_VAR_2": "window_2"},
[   84s]         ],
[   84s]     )
[   84s]     def test_new_window_with_environment(
[   84s]         session: Session,
[   84s]         environment: t.Dict[str, str],
[   84s]     ) -> None:
[   84s]         env = shutil.which("env")
[   84s]         assert env is not None, "Cannot find usable `env` in PATH."
[   84s]     
[   84s]         window = session.new_window(
[   84s]             attach=True,
[   84s]             window_name="window_with_environment",
[   84s]             window_shell=f"{env} PS1='$ ' sh",
[   84s]             environment=environment,
[   84s]         )
[   84s]         pane = window.attached_pane
[   84s]         assert pane is not None
[   84s]         for k, v in environment.items():
[   84s]             pane.send_keys(f"echo ${k}")
[   84s] >           assert pane.capture_pane()[-2] == v
[   84s] E           IndexError: list index out of range
[   84s] 
[   84s] tests/legacy_api/test_session.py:291: IndexError
[   84s] =============================== warnings summary ===============================