Skip to content

Commit

Permalink
test(legacy[session]) Stabilize assertion
Browse files Browse the repository at this point in the history
=================================== FAILURES ===================================
______________________________ test_select_window ______________________________
[gw0] linux -- Python 3.13.0 /home/runner/work/libtmux/libtmux/.venv/bin/python
tests/legacy_api/test_session.py:51: in test_select_window
    assert selected_window1.__dict__ == attached_window1.__dict__
E   AssertionError: assert {'active_wind...e': None, ...} == {'active_wind...e': None, ...}
E
E     Omitting 125 identical items, use -vv to show
E     Differing items:
E     {'cursor_x': '0'} != {'cursor_x': '56'}
E     Use -v to get more diff
        attached_window1 = Window(@1 1:bash, Session($1 libtmux_yphmur0x))
        selected_window1 = Window(@1 1:bash, Session($1 libtmux_yphmur0x))
        session    = Session($1 libtmux_yphmur0x)
        window_base_index = 1
        window_count = 2
        window_idx = '1'

---------- coverage: platform linux, python 3.13.0-final-0 -----------
Coverage XML written to file coverage.xml

=========================== short test summary info ============================
FAILED tests/legacy_api/test_session.py::test_select_window - AssertionError: assert {'active_wind...e': None, ...} == {'active_wind...e': None, ...}

  Omitting 125 identical items, use -vv to show
  Differing items:
  {'cursor_x': '0'} != {'cursor_x': '56'}
  Use -v to get more diff
============= 1 failed, 439 passed, 12 skipped, 2 rerun in 17.[92](https://github.com/tmux-python/libtmux/actions/runs/12441319490/job/34738031175#step:12:93)s ==============

============================= test session starts ==============================
created: 4/4 workers
4 workers [452 items]

........................................................................ [ 15%]
.....s...............................................s.s................ [ 31%]
..............................................s...R........R.......Fs.s. [ 47%]
.................................................R..s...........ss...... [ 63%]
.......................s..s.....s.....................s.s.s..s....s.s... [ 78%]
........................................................................ [ 94%]
.......................                                                  [100%]
=================================== FAILURES ===================================
______________________________ test_select_window ______________________________
[gw0] linux -- Python 3.13.0 /home/runner/work/libtmux/libtmux/.venv/bin/python
tests/legacy_api/test_session.py:61: in test_select_window
    assert selected_window2.__dict__ == attached_window2.__dict__
E   AssertionError: assert {'active_wind...e': None, ...} == {'active_wind...e': None, ...}
E
E     Omitting 125 identical items, use -vv to show
E     Differing items:
E     {'cursor_x': '0'} != {'cursor_x': '56'}
E     Use -v to get more diff
        attached_window1 = Window(@1 1:bash, Session($1 libtmux__xf1mgsj))
        attached_window2 = Window(@2 2:test_window, Session($1 libtmux__xf1mgsj))
        selected_window1 = Window(@1 1:bash, Session($1 libtmux__xf1mgsj))
        selected_window2 = Window(@2 2:test_window, Session($1 libtmux__xf1mgsj))
        session    = Session($1 libtmux__xf1mgsj)
        window_base_index = 1
        window_count = 2
        window_idx = '1'
=============================== warnings summary ===============================
src/libtmux/pane.py::libtmux.pane.Pane.kill
  <doctest libtmux.pane.Pane.kill[4]>:1: UserWarning: resize() requires tmux 2.9 or newer

tests/legacy_api/test_window.py::test_split_window_size
  /home/runner/work/libtmux/libtmux/tests/legacy_api/test_window.py:185: UserWarning: resize() requires tmux 2.9 or newer
    window.resize(height=100, width=100)

tests/legacy_api/test_window.py::test_split_percentage
  /home/runner/work/libtmux/libtmux/tests/legacy_api/test_window.py:1[68](https://github.com/tmux-python/libtmux/actions/runs/12440365752/job/34735725442#step:12:69): UserWarning: resize() requires tmux 2.9 or newer
    window.resize(height=100, width=100)

tests/test_pane.py::test_split_pane_size
  /home/runner/work/libtmux/libtmux/tests/test_pane.py:279: UserWarning: resize() requires tmux 2.9 or newer
    window.resize(height=100, width=100)

tests/test_window.py::test_split_size
  /home/runner/work/libtmux/libtmux/tests/test_window.py:182: UserWarning: resize() requires tmux 2.9 or newer
    window.resize(height=100, width=100)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

---------- coverage: platform linux, python 3.13.0-final-0 -----------
Coverage XML written to file coverage.xml

=========================== short test summary info ============================
FAILED tests/legacy_api/test_session.py::test_select_window - AssertionError: assert {'active_wind...e': None, ...} == {'active_wind...e': None, ...}

  Omitting 125 identical items, use -vv to show
  Differing items:
  {'cursor_x': '0'} != {'cursor_x': '56'}
  Use -v to get more diff
======= 1 failed, 433 passed, 18 skipped, 5 warnings, 3 rerun in 17.00s ========
  • Loading branch information
tony committed Dec 21, 2024
1 parent 274d4c9 commit 97d83af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
9 changes: 3 additions & 6 deletions tests/legacy_api/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,18 @@ def test_select_window(session: Session) -> None:
assert isinstance(selected_window1, Window)
attached_window1 = session.attached_window

assert selected_window1 == attached_window1
assert selected_window1.__dict__ == attached_window1.__dict__
assert selected_window1.id == attached_window1.id

# again: tmux selects a window, moves to it, shows it as
# attached_window
selected_window2 = session.select_window(window_base_index + 1)
assert isinstance(selected_window2, Window)
attached_window2 = session.attached_window

assert selected_window2 == attached_window2
assert selected_window2.__dict__ == attached_window2.__dict__
assert selected_window2.id == attached_window2.id

# assure these windows were really different
assert selected_window1 != selected_window2
assert selected_window1.__dict__ != selected_window2.__dict__
assert selected_window1.id != selected_window2.id


def test_select_window_returns_Window(session: Session) -> None:
Expand Down
9 changes: 3 additions & 6 deletions tests/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,18 @@ def test_select_window(session: Session) -> None:
assert isinstance(selected_window1, Window)
active_window1 = session.active_window

assert selected_window1 == active_window1
assert selected_window1.__dict__ == active_window1.__dict__
assert selected_window1.id == active_window1.id

# again: tmux selects a window, moves to it, shows it as
# active_window
selected_window2 = session.select_window(window_base_index + 1)
assert isinstance(selected_window2, Window)
active_window2 = session.active_window

assert selected_window2 == active_window2
assert selected_window2.__dict__ == active_window2.__dict__
assert selected_window2.id == active_window2.id

# assure these windows were really different
assert selected_window1 != selected_window2
assert selected_window1.__dict__ != selected_window2.__dict__
assert selected_window1.id != selected_window2.id


def test_select_window_returns_Window(session: Session) -> None:
Expand Down

0 comments on commit 97d83af

Please sign in to comment.