def test_two_split_panes(capsys):
    """
    Test two windows, both with split panes
    """
    builder = TmuxBuilder("session", "/var")
    builder.add_window("win1", "pane1", "window")
    builder.add_pane("pane2", SPLIT_HORIZONTAL)
    builder.run_command("top")
    builder.run_command("echo", "win1", "pane1")
    builder.add_window("win2", "pane3", "window2", "/home")
    builder.add_pane("pane4", SPLIT_VERTICAL, working_directory="/etc")
    builder.run_command("tail")
    actual = convert_lines_to_object(builder.build().split("\n"))

    expected = convert_lines_to_object(
        [
            'pushd "/var"',
            "tmux new-session -d -s session \\; \\",
            "rename-window window \\; \\",
            'send-keys "echo" "C-m" \\; \\',
            'split-window -h -c "/var" \\; \\',
            'send-keys "top" "C-m" \\; \\',
            'new-window -n window2 -c "/home" \\; \\',
            'split-window -v -c "/etc" \\; \\',
            'send-keys "tail" "C-m"',
            "popd",
        ]
    )

    assert_objects_equal(expected, actual, expected.keys(), capsys)
def test_middle_split_pane_with_sizing(capsys):
    """
    Split a pane in between two others, setting its size
    """
    builder = TmuxBuilder("session", "/var").set_terminal_size(200, 200)
    builder.add_window("w0", "w0p0", "w0")
    builder.set_pane_width(40)
    builder.add_pane("w0p1", SPLIT_HORIZONTAL)
    builder.add_pane("w0p2", SPLIT_HORIZONTAL)
    # This becomes pane number 2, since horizontally before pane w0p3
    builder.add_pane("w0p3", SPLIT_VERTICAL, split_from="w0p1")
    builder.set_pane_width(30)
    builder.set_pane_height(20)
    actual = convert_lines_to_object(builder.build().split("\n"))

    expected = convert_lines_to_object(
        [
            'pushd "/var"',
            "tmux new-session -d -s session \\; \\",
            "rename-window w0 \\; \\",
            'split-window -h -c "/var" \\; \\',
            'split-window -h -c "/var" \\; \\',
            'split-window -v -t session:0.1 -c "/var" \\; \\',
            "resize-pane -t session:0.0 -x 80  \\; \\",
            "resize-pane -t session:0.2 -x 60 -y 40",
            "popd",
        ]
    )

    assert_objects_equal(expected, actual, expected.keys(), capsys)
def test_double_three_split_with_target(capsys):
    """
    Test three-way split in two directions, with window targets
    0 |
    - | 2
    1 |

    0 | 1
    -----
      2
    """
    builder = TmuxBuilder("session", "/")
    builder.add_window("w1", "w1p1", "w1")
    builder.add_pane("w1p2", SPLIT_HORIZONTAL)
    builder.add_window("w2", "w2p1", "w2", "/home")
    builder.add_pane("w2p2", SPLIT_VERTICAL, "w2", working_directory="/etc")
    builder.add_pane("w1p3", SPLIT_VERTICAL, split_from="w1p1")
    builder.add_pane("w2p3", SPLIT_HORIZONTAL, split_from="w2p1")
    actual = convert_lines_to_object(builder.build().split("\n"))

    expected = convert_lines_to_object(
        [
            'pushd "/"',
            "tmux new-session -d -s session \\; \\",
            "rename-window w1 \\; \\",
            'split-window -h -c "/" \\; \\',
            'split-window -v -t session:0.0 -c "/" \\; \\',
            'new-window -n w2 -c "/home" \\; \\',
            'split-window -v -c "/etc" \\; \\',
            'split-window -h -t session:1.0 -c "/home"',
            "popd",
        ]
    )

    assert_objects_equal(expected, actual, expected.keys(), capsys)
def test_multiple_sequential_splits(capsys):
    """
    Test splitting a window in multiple directions, sequentially
    """
    builder = TmuxBuilder("session", "/var")
    builder.add_window("w1", "w1p1", "w1")
    builder.add_pane("w1p2", SPLIT_HORIZONTAL)
    builder.add_pane("w1p3", SPLIT_VERTICAL)
    builder.add_pane("w1p4", SPLIT_VERTICAL)
    builder.add_pane("w1p5", SPLIT_HORIZONTAL)
    actual = convert_lines_to_object(builder.build().split("\n"))

    expected = convert_lines_to_object(
        [
            'pushd "/var"',
            "tmux new-session -d -s session \\; \\",
            "rename-window w1 \\; \\",
            'split-window -h -c "/var" \\; \\',
            'split-window -v -c "/var" \\; \\',
            'split-window -v -c "/var" \\; \\',
            'split-window -h -c "/var"',
            "popd",
        ]
    )

    assert_objects_equal(expected, actual, expected.keys(), capsys)
Beispiel #5
0
def test_single_pane_session(capsys):
    """
    Test creating a session with a single pane
    """

    window_data = [
        {
            "identity": "window",
            "number": 0,
            "title": "window",
            "postfix": "~-*",
            "layout": "c6e0,200x60,0,0,0",
            "panes": [{"identity": "pane", "number": 0, "command": "top"}],
        }
    ]

    window_list = set_session_parameters(
        DEFAULT_SESSION, DEFAULT_DIRECTORY, window_data,
    )

    scripter = TmuxScripter(DEFAULT_SESSION, DEFAULT_DIRECTORY)
    scripter.analyze(window_list)

    expected = convert_lines_to_object(
        GENERIC_START + ['send-keys "top" "C-m"', "popd",]
    )
    actual = convert_lines_to_object(scripter.commands.split("\n"))

    assert_objects_equal(expected, actual, expected.keys(), capsys)
Beispiel #6
0
def test_nested_middle_split(capsys):
    """
    Tests a layout which has nested splits, but around a middle section

      0  |   |  3
     --- | 2 | ---
      1  |   |  4
    """

    window_layout = (
        "32ff,200x60,0,0{"
        "30x60,0,0[30x20,0,0,49,30x40,0,31,53],"
        "100x60,31,0,50,"
        "70x60,131,0[70x45,131,0,51,70x15,131,46,52]}"
    )
    window_data = [
        {
            "identity": "window",
            "number": 0,
            "title": "window",
            "postfix": "~-",
            "layout": window_layout,
            "panes": [
                {"identity": "pane0", "number": 0},
                {"identity": "pane1", "number": 1, "parent": "pane0"},
                {"identity": "pane2", "number": 2, "parent": "pane0"},
                {"identity": "pane3", "number": 3, "parent": "pane2"},
                {"identity": "pane4", "number": 4, "parent": "pane3"},
            ],
        }
    ]

    window_list = set_session_parameters(
        DEFAULT_SESSION, DEFAULT_DIRECTORY, window_data,
    )

    scripter = TmuxScripter(DEFAULT_SESSION, DEFAULT_DIRECTORY).set_terminal_size(
        TERMINAL_WIDTH, TERMINAL_HEIGHT
    )
    scripter.analyze(window_list)

    expected = convert_lines_to_object(
        GENERIC_START
        + [
            'split-window -h -t session:0.0 -c "/home/brett" \\; \\',
            'split-window -h -t session:0.1 -c "/home/brett" \\; \\',
            'split-window -v -t session:0.0 -c "/home/brett" \\; \\',
            'split-window -v -t session:0.3 -c "/home/brett" \\; \\',
            "resize-pane -t session:0.0 -x 30 -y 20 \\; \\",
            "resize-pane -t session:0.2 -x 100 -y 60 \\; \\",
            "resize-pane -t session:0.3 -x 70 -y 45 \\; \\",
            "resize-pane -t session:0.1 -x 30 -y 40 \\; \\",
            "resize-pane -t session:0.4 -x 70 -y 15",
            "popd",
        ]
    )
    actual = convert_lines_to_object(scripter.commands.split("\n"))

    assert_objects_equal(expected, actual, expected.keys(), capsys)
Beispiel #7
0
def test_split_pane_session(capsys):
    """
    Test a session with a single window, with a split pane
    """

    window_data = [
        {
            "identity": "window",
            "number": 0,
            "title": "window",
            "postfix": "~-",
            "dir": DEFAULT_DIRECTORY,
            "layout": "c6e0,200x60,0,0{100x60,0,0,0,100x60,101,0,1}",
            "panes": [
                {"identity": "pane", "number": 0, "command": "top"},
                {
                    "identity": "pane2",
                    "number": 1,
                    "dir": "/var/log",
                    "command": "tail -f syslog",
                    "parent": "pane",
                },
            ],
        }
    ]

    window_list = set_session_parameters(
        DEFAULT_SESSION, DEFAULT_DIRECTORY, window_data,
    )

    scripter = TmuxScripter(DEFAULT_SESSION, DEFAULT_DIRECTORY).set_terminal_size(
        TERMINAL_WIDTH, TERMINAL_HEIGHT
    )
    scripter.analyze(window_list)

    expected = convert_lines_to_object(
        GENERIC_START
        + [
            'send-keys "top" "C-m" \\; \\',
            'split-window -h -t session:0.0 -c "/var/log" \\; \\',
            'send-keys "tail -f syslog" "C-m" \\; \\',
            "resize-pane -t session:0.0 -x 100 -y 60 \\; \\",
            "resize-pane -t session:0.1 -x 100 -y 60",
            "popd",
        ]
    )
    actual = convert_lines_to_object(scripter.commands.split("\n"))

    assert_objects_equal(expected, actual, expected.keys(), capsys)
def test_single_pane_window(capsys):
    """
    Test the creation of a basic single-pane window
    """
    builder = TmuxBuilder("session", "/etc")
    builder.add_window("win1", "pane1", "window", "/home")
    builder.run_command("top")
    actual = convert_lines_to_object(builder.build().split("\n"))

    expected = convert_lines_to_object(
        [
            'pushd "/etc"',
            "tmux new-session -d -s session \\; \\",
            "rename-window window \\; \\",
            'send-keys "top" "C-m"',
            "popd",
        ]
    )

    assert_objects_equal(expected, actual, expected.keys(), capsys)
def test_two_window_single_pane(capsys):
    """
    Test two windows with single panes
    """
    builder = TmuxBuilder("session", "/var")
    builder.add_window("win1", "pane1", "window")
    builder.run_command("top")
    builder.add_window("win2", "pane2", "window2", "/home")
    builder.run_command("tail")
    actual = convert_lines_to_object(builder.build().split("\n"))

    expected = convert_lines_to_object(
        [
            'pushd "/var"',
            "tmux new-session -d -s session \\; \\",
            "rename-window window \\; \\",
            'send-keys "top" "C-m" \\; \\',
            'new-window -n window2 -c "/home" \\; \\',
            'send-keys "tail" "C-m"',
            "popd",
        ]
    )

    assert_objects_equal(expected, actual, expected.keys(), capsys)
def test_many_hard_panes(capsys):
    """
    Test creation of a bunch of complex windows
    """
    # Expected result:
    #  w0p0 (0) | w0p1 (2) |
    #  -------- | -------- | w0p2 (4)
    #  w0p3 (1) | w0p4 (3) |
    builder = TmuxBuilder("session", "/var")
    builder.add_window("w0", "w0p0", "w0")
    builder.add_pane("w0p1", SPLIT_HORIZONTAL)
    builder.add_pane("w0p2", SPLIT_HORIZONTAL)
    builder.add_pane("w0p3", SPLIT_VERTICAL, split_from="w0p0")
    # Will actually be split from pane #2, since the one before this was inserted after pane #0
    # Which causes pane #1 to become pane #2
    builder.add_pane("w0p4", SPLIT_VERTICAL, split_from="w0p1")

    # Expected result:
    #  w1p0 (0) |      w1p1 (2)       |
    #  -------- | ------------------- | w1p2 (5)
    #  w1p3 (1) | w1p4 (3) | w1p5 (4) |
    builder.add_window("w1", "w1p0", "w1")
    builder.add_pane("w1p1", SPLIT_HORIZONTAL)
    builder.add_pane("w1p2", SPLIT_HORIZONTAL)
    builder.add_pane("w1p3", SPLIT_VERTICAL, split_from="w1p0")
    # Will actually be split from pane #2,
    # since the one before this was inserted after pane #0
    # Which causes pane #1 to become pane #2
    builder.add_pane("w1p4", SPLIT_VERTICAL, split_from="w1p1")
    builder.add_pane("w1p5", SPLIT_HORIZONTAL)

    # Expected result:
    #          | w2p3 (1)
    # w2p0 (0) | --------
    #          | w2p4 (2)
    # -------------------
    #      w2p1 (3)
    # -------------------
    # w2p2 (4) | w2p5 (5)
    builder.add_window("w2", "w2p0", "w2")
    builder.add_pane("w2p1", SPLIT_VERTICAL)
    builder.add_pane("w2p2", SPLIT_VERTICAL)
    builder.add_pane("w2p3", SPLIT_HORIZONTAL, split_from="w2p0")
    builder.add_pane("w2p4", SPLIT_VERTICAL)
    # This is split from pane #3 since the top pane was split once
    builder.add_pane("w2p5", SPLIT_HORIZONTAL, split_from="w2p2")

    # Expected result:
    #          | w3p1 (1) | w3p3 (2)
    # w3p0 (0) | -------------------
    #          |      w3p2 (3)
    builder.add_window("w3", "w3p0", "w3")
    builder.add_pane("w3p1", SPLIT_HORIZONTAL)
    builder.add_pane("w3p2", SPLIT_VERTICAL, split_from="w3p1")
    builder.add_pane("w3p3", SPLIT_HORIZONTAL, split_from="w3p1")

    actual = convert_lines_to_object(builder.build().split("\n"))

    expected = convert_lines_to_object(
        [
            'pushd "/var"',
            "tmux new-session -d -s session \\; \\",
            "rename-window w0 \\; \\",
            'split-window -h -c "/var" \\; \\',
            'split-window -h -c "/var" \\; \\',
            'split-window -v -t session:0.0 -c "/var" \\; \\',
            'split-window -v -t session:0.2 -c "/var" \\; \\',
            'new-window -n w1 -c "/var" \\; \\',
            'split-window -h -c "/var" \\; \\',
            'split-window -h -c "/var" \\; \\',
            'split-window -v -t session:1.0 -c "/var" \\; \\',
            'split-window -v -t session:1.2 -c "/var" \\; \\',
            'split-window -h -c "/var" \\; \\',
            'new-window -n w2 -c "/var" \\; \\',
            'split-window -v -c "/var" \\; \\',
            'split-window -v -c "/var" \\; \\',
            'split-window -h -t session:2.0 -c "/var" \\; \\',
            'split-window -v -c "/var" \\; \\',
            'split-window -h -t session:2.3 -c "/var" \\; \\',
            'new-window -n w3 -c "/var" \\; \\',
            'split-window -h -c "/var" \\; \\',
            'split-window -v -t session:3.1 -c "/var" \\; \\',
            'split-window -h -t session:3.1 -c "/var"',
            "popd",
        ]
    )
    assert_objects_equal(expected, actual, expected.keys(), capsys)
Beispiel #11
0
def test_vertical_tri_split_with_hitch(capsys):
    """
    A complex vertical layout with nine panes

     0 | 1 | 2
    -----------
       3 | 4
    -----------
       | 6 |
     5 |---| 8
       | 7 |
    """

    window_layout = (
        # Top set
        "32ff,200x60,0,0[200x12,0,0{30x12,0,0,49,50x12,31,0,53,120x12,81,0,54},"
        # Second set
        "200x18,0,31{150x18,0,31,50,50x18,151,31,55},"
        # First pane of third set
        "200x30,0,31{100x30,0,31,51,60x30,101,46"
        # Second group and third pane of bottom set
        "[60x10,101,31,52,60x20,101,41,57],40x30,161,31,56}]"
    )
    window_data = [
        {
            "identity": "window",
            "number": 0,
            "title": "window",
            "postfix": "~-",
            "layout": window_layout,
            "panes": [
                {"identity": "pane0", "number": 0},
                {"identity": "pane1", "number": 1, "parent": "pane0"},
                {"identity": "pane2", "number": 2, "parent": "pane1"},
                {"identity": "pane3", "number": 3, "parent": "pane0"},
                {"identity": "pane4", "number": 4, "parent": "pane3"},
                {"identity": "pane5", "number": 5, "parent": "pane3"},
                {"identity": "pane6", "number": 6, "parent": "pane5"},
                {
                    "identity": "pane7",
                    "number": 7,
                    "parent": "pane6",
                    "command": "htop",
                },
                {"identity": "pane8", "number": 8, "parent": "pane6",},
            ],
        }
    ]

    window_list = set_session_parameters(
        DEFAULT_SESSION, DEFAULT_DIRECTORY, window_data,
    )

    scripter = TmuxScripter(DEFAULT_SESSION, DEFAULT_DIRECTORY).set_terminal_size(
        TERMINAL_WIDTH, TERMINAL_HEIGHT
    )
    scripter.analyze(window_list)

    expected = convert_lines_to_object(
        GENERIC_START
        + [
            'split-window -v -t session:0.0 -c "/home/brett" \\; \\',
            'split-window -v -t session:0.1 -c "/home/brett" \\; \\',
            'split-window -h -t session:0.0 -c "/home/brett" \\; \\',
            'split-window -h -t session:0.1 -c "/home/brett" \\; \\',
            'split-window -h -t session:0.3 -c "/home/brett" \\; \\',
            'split-window -h -t session:0.5 -c "/home/brett" \\; \\',
            'split-window -h -t session:0.6 -c "/home/brett" \\; \\',
            'split-window -v -t session:0.6 -c "/home/brett" \\; \\',
            'send-keys "htop" "C-m" \\; \\',
            "resize-pane -t session:0.0 -x 30 -y 12 \\; \\",
            "resize-pane -t session:0.3 -x 150 -y 18 \\; \\",
            "resize-pane -t session:0.5 -x 100 -y 30 \\; \\",
            "resize-pane -t session:0.1 -x 50 -y 12 \\; \\",
            "resize-pane -t session:0.2 -x 120 -y 12 \\; \\",
            "resize-pane -t session:0.4 -x 50 -y 18 \\; \\",
            "resize-pane -t session:0.6 -x 60 -y 10 \\; \\",
            "resize-pane -t session:0.8 -x 40 -y 30 \\; \\",
            "resize-pane -t session:0.7 -x 60 -y 20",
            "popd",
        ]
    )
    actual = convert_lines_to_object(scripter.commands.split("\n"))

    assert_objects_equal(expected, actual, expected.keys(), capsys)
Beispiel #12
0
def test_horizontal_tri_split(capsys):
    """
    A complex horizontal layout with eight panes

     0 |     |  5
    ---|  3  | ---
     1 | --- |  6
    ---|  4  | ---
     2 |     |  7
    """

    window_layout = (
        "32ff,200x60,0,0"
        "{30x60,0,0[30x10,0,0,49,30x30,0,11,53,30x20,0,41,54],"
        "70x60,31,0[70x24,31,0,50,70x36,31,26,55],"
        "100x60,101,0[100x45,101,0,51,100x10,101,46,52,100x5,101,56,56]}"
    )
    window_data = [
        {
            "identity": "window",
            "number": 0,
            "title": "window",
            "postfix": "~-",
            "layout": window_layout,
            "panes": [
                {"identity": "pane0", "number": 0},
                {"identity": "pane1", "number": 1, "parent": "pane0"},
                {
                    "identity": "pane2",
                    "number": 2,
                    "parent": "pane1",
                    "command": "cat test.txt",
                },
                {"identity": "pane3", "number": 3, "parent": "pane0"},
                {
                    "identity": "pane4",
                    "number": 4,
                    "parent": "pane3",
                    "command": 'echo "hello world"',
                },
                {"identity": "pane5", "number": 5, "parent": "pane3"},
                {"identity": "pane6", "number": 6, "parent": "pane5"},
                {
                    "identity": "pane7",
                    "number": 7,
                    "parent": "pane6",
                    "command": "htop",
                },
            ],
        }
    ]

    window_list = set_session_parameters(
        DEFAULT_SESSION, DEFAULT_DIRECTORY, window_data,
    )

    scripter = TmuxScripter(DEFAULT_SESSION, DEFAULT_DIRECTORY).set_terminal_size(
        TERMINAL_WIDTH, TERMINAL_HEIGHT
    )
    scripter.analyze(window_list)

    expected = convert_lines_to_object(
        GENERIC_START
        + [
            'split-window -h -t session:0.0 -c "/home/brett" \\; \\',
            'split-window -h -t session:0.1 -c "/home/brett" \\; \\',
            'split-window -v -t session:0.0 -c "/home/brett" \\; \\',
            'split-window -v -t session:0.1 -c "/home/brett" \\; \\',
            'send-keys "cat test.txt" "C-m" \\; \\',
            'split-window -v -t session:0.3 -c "/home/brett" \\; \\',
            'send-keys "echo \\"hello world\\"" "C-m" \\; \\',
            'split-window -v -t session:0.5 -c "/home/brett" \\; \\',
            'split-window -v -t session:0.6 -c "/home/brett" \\; \\',
            'send-keys "htop" "C-m" \\; \\',
            "resize-pane -t session:0.0 -x 30 -y 10 \\; \\",
            "resize-pane -t session:0.3 -x 70 -y 24 \\; \\",
            "resize-pane -t session:0.5 -x 100 -y 45 \\; \\",
            "resize-pane -t session:0.1 -x 30 -y 30 \\; \\",
            "resize-pane -t session:0.2 -x 30 -y 20 \\; \\",
            "resize-pane -t session:0.4 -x 70 -y 36 \\; \\",
            "resize-pane -t session:0.6 -x 100 -y 10 \\; \\",
            "resize-pane -t session:0.7 -x 100 -y 5",
            "popd",
        ]
    )
    actual = convert_lines_to_object(scripter.commands.split("\n"))

    assert_objects_equal(expected, actual, expected.keys(), capsys)
Beispiel #13
0
def test_nested_split(capsys):
    """
    Tests a layout which has nested splits

      0  |  2  |
     --- | --- | 4
      1  |  3  |
    """

    window_layout = (
        "32ff,200x60,0,0{100x60,0,0[100x30,0,0,49,100x30,0,31,53],50x60,119,0"
        "[50x30,101,0,51,50x30,101,31,52],50x60,151,0,51}"
    )
    window_data = [
        {
            "identity": "window",
            "number": 0,
            "title": "window",
            "postfix": "~-",
            "layout": window_layout,
            "panes": [
                {"identity": "pane0", "number": 0, "command": "top"},
                {"identity": "pane1", "number": 1, "parent": "pane0"},
                {"identity": "pane2", "number": 2, "parent": "pane0"},
                {
                    "identity": "pane3",
                    "number": 3,
                    "parent": "pane2",
                    "command": "tail -f foo.txt",
                },
                {
                    "identity": "pane4",
                    "number": 4,
                    "parent": "pane2",
                    "command": "tail -f test.txt",
                },
            ],
        }
    ]

    window_list = set_session_parameters(
        DEFAULT_SESSION, DEFAULT_DIRECTORY, window_data,
    )

    scripter = TmuxScripter(DEFAULT_SESSION, DEFAULT_DIRECTORY).set_terminal_size(
        TERMINAL_WIDTH, TERMINAL_HEIGHT
    )
    scripter.analyze(window_list)

    expected = convert_lines_to_object(
        GENERIC_START
        + [
            'send-keys "top" "C-m" \\; \\',
            'split-window -h -t session:0.0 -c "/home/brett" \\; \\',
            'split-window -h -t session:0.1 -c "/home/brett" \\; \\',
            'send-keys "tail -f test.txt" "C-m" \\; \\',
            'split-window -v -t session:0.0 -c "/home/brett" \\; \\',
            'split-window -v -t session:0.2 -c "/home/brett" \\; \\',
            'send-keys "tail -f foo.txt" "C-m" \\; \\',
            "resize-pane -t session:0.0 -x 100 -y 30 \\; \\",
            "resize-pane -t session:0.2 -x 50 -y 30 \\; \\",
            "resize-pane -t session:0.4 -x 50 -y 60 \\; \\",
            "resize-pane -t session:0.1 -x 100 -y 30 \\; \\",
            "resize-pane -t session:0.3 -x 50 -y 30",
            "popd",
        ]
    )
    actual = convert_lines_to_object(scripter.commands.split("\n"))

    assert_objects_equal(expected, actual, expected.keys(), capsys)
Beispiel #14
0
def test_two_perpendicular_windows(capsys):
    """
    Check a session with two windows, one split vertically, the horizontally
    Should make this:

    Window 0:
       |  1
     0 | ---
       |  2

    Window 1:
      0
    -----
    1 | 2

    """

    window_layout_one = (
        "b652,200x60,0,0{100x60,0,0,255,100x60,101,0"
        "[100x40,101,0,256,100x20,101,41,257]}"
    )
    window_layout_two = (
        "6fc3,200x60,0,0[200x30,0,0,258,"
        "200x30,0,31{150x30,0,31,259,50x30,151,31,260}]"
    )
    window_data = [
        {
            "identity": "window",
            "number": 0,
            "title": "window",
            "postfix": "~-",
            "layout": window_layout_one,
            "panes": [
                {"identity": "pane", "number": 0, "command": "top"},
                {
                    "identity": "pane2",
                    "number": 1,
                    "dir": "/var/log",
                    "command": "tail -f syslog",
                    "parent": "pane",
                },
                {
                    "identity": "pane3",
                    "number": 2,
                    "command": "vi test.py",
                    "parent": "pane2",
                },
            ],
        },
        {
            "identity": "window2",
            "number": 1,
            "title": "zsh",
            "postfix": "*Z",
            "dir": "/root",
            "layout": window_layout_two,
            "panes": [
                {
                    "identity": "pane4",
                    "number": 0,
                    # This should override the window directory
                    "dir": "/home/brett",
                },
                {
                    "identity": "pane5",
                    "number": 1,
                    "command": "cat bar",
                    "parent": "pane4",
                },
                {
                    "identity": "pane6",
                    "number": 2,
                    "dir": DEFAULT_DIRECTORY,
                    "command": "netstat -noap | grep 443",
                    "parent": "pane5",
                },
            ],
        },
    ]

    window_list = set_session_parameters(
        DEFAULT_SESSION, DEFAULT_DIRECTORY, window_data,
    )

    scripter = TmuxScripter(DEFAULT_SESSION, DEFAULT_DIRECTORY).set_terminal_size(
        TERMINAL_WIDTH, TERMINAL_HEIGHT
    )
    scripter.analyze(window_list)

    expected = convert_lines_to_object(
        GENERIC_START
        + [
            'send-keys "top" "C-m" \\; \\',
            'split-window -h -t session:0.0 -c "/var/log" \\; \\',
            'send-keys "tail -f syslog" "C-m" \\; \\',
            'split-window -v -t session:0.1 -c "/home/brett" \\; \\',
            'send-keys "vi test.py" "C-m" \\; \\',
            'new-window -n zsh -c "/home/brett" \\; \\',
            'split-window -v -t session:1.0 -c "/root" \\; \\',
            'send-keys "cat bar" "C-m" \\; \\',
            'split-window -h -t session:1.1 -c "/home/brett" \\; \\',
            'send-keys "netstat -noap | grep 443" "C-m" \\; \\',
            "resize-pane -t session:0.0 -x 100 -y 60 \\; \\",
            "resize-pane -t session:0.1 -x 100 -y 40 \\; \\",
            "resize-pane -t session:0.2 -x 100 -y 20 \\; \\",
            "resize-pane -t session:1.0 -x 200 -y 30 \\; \\",
            "resize-pane -t session:1.1 -x 150 -y 30 \\; \\",
            "resize-pane -t session:1.2 -x 50 -y 30",
            "popd",
        ]
    )
    actual = convert_lines_to_object(scripter.commands.split("\n"))

    assert_objects_equal(expected, actual, expected.keys(), capsys)