How to use the tmuxp.config.validate_schema function in tmuxp

To help you get started, we’ve selected a few tmuxp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tmux-python / tmuxp / tests / test_config_tmuxinator.py View on Github external
def test_config_to_dict(tmuxinator_yaml, tmuxinator_dict, tmuxp_dict):
    configparser = kaptan.Kaptan(handler='yaml')
    test_config = configparser.import_config(tmuxinator_yaml)
    yaml_to_dict = test_config.get()
    assert yaml_to_dict == tmuxinator_dict

    assert config.import_tmuxinator(tmuxinator_dict) == tmuxp_dict

    config.validate_schema(config.import_tmuxinator(tmuxinator_dict))
github tmux-python / tmuxp / tests / test_workspacefreezer.py View on Github external
def test_freeze_config(session):
    yaml_config = loadfixture("workspacefreezer/sampleconfig.yaml")
    sconfig = kaptan.Kaptan(handler='yaml')
    sconfig = sconfig.import_config(yaml_config).get()

    builder = WorkspaceBuilder(sconf=sconfig)
    builder.build(session=session)
    assert session == builder.session

    time.sleep(0.50)

    session = session
    sconf = freeze(session)

    config.validate_schema(sconf)

    sconf = config.inline(sconf)

    kaptanconf = kaptan.Kaptan()
    kaptanconf = kaptanconf.import_config(sconf)
    kaptanconf.export('json', indent=2)
    kaptanconf.export('yaml', indent=2, default_flow_style=False, safe=True)
github tmux-python / tmuxp / tests / test_config.py View on Github external
- window_name: editor
      panes:
      shell_command:
      - tail -F /var/log/syslog
      start_directory: /var/log
    - automatic-rename: true
      panes:
      - shell_command:
      - htop
    """

    sconfig = kaptan.Kaptan(handler='yaml')
    sconfig = sconfig.import_config(yaml_config).get()

    with pytest.raises(exc.ConfigError) as excinfo:
        config.validate_schema(sconfig)
        assert excinfo.matches('missing "window_name"')
github tmux-python / tmuxp / tests / test_config.py View on Github external
panes:
      shell_command:
      - tail -F /var/log/syslog
      start_directory: /var/log
    - window_name: logging
      automatic-rename: true
      panes:
      - shell_command:
      - htop
    """

    sconfig = kaptan.Kaptan(handler='yaml')
    sconfig = sconfig.import_config(yaml_config).get()

    with pytest.raises(exc.ConfigError) as excinfo:
        config.validate_schema(sconfig)
        assert excinfo.matches(r'requires "session_name"')
github tmux-python / tmuxp / tests / test_config.py View on Github external
def test_trickle_window_with_no_pane_config():
    test_yaml = """
    session_name: test_session
    windows:
    - window_name: test_1
      panes:
      - shell_command:
        - ls -l
    - window_name: test_no_panes
    """
    sconfig = load_yaml(test_yaml)
    config.validate_schema(sconfig)

    assert config.expand(config.trickle(sconfig))['windows'][1]['panes'][0] == {
        'shell_command': []
    }
github tmux-python / tmuxp / tests / test_config.py View on Github external
def test_in_session_scope():
    sconfig = load_yaml(fixtures.shell_command_before_session.before)

    config.validate_schema(sconfig)

    assert config.expand(sconfig) == sconfig
    assert config.expand(config.trickle(sconfig)) == load_yaml(
        fixtures.shell_command_before_session.expected
    )
github tmux-python / tmuxp / tests / test_config.py View on Github external
def test_no_windows():
    yaml_config = """
    session_name: test session
    """

    sconfig = kaptan.Kaptan(handler='yaml')
    sconfig = sconfig.import_config(yaml_config).get()

    with pytest.raises(exc.ConfigError) as excinfo:
        config.validate_schema(sconfig)
        assert excinfo.match(r'list of "windows"')