pytest.helpers.os_split

Here are the examples of the python api pytest.helpers.os_split taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

7 Examples 7

Example 1

Project: molecule Source File: test_config.py
def test_build_config_paths(config_instance):
    parts = pytest.helpers.os_split(config_instance.config['molecule'][
        'state_file'])
    assert ('state.yml') == parts[-1]
    assert 'test/vagrantfile_file' == config_instance.config['molecule'][
        'vagrantfile_file']
    assert 'test/rakefile_file' == config_instance.config['molecule'][
        'rakefile_file']
    assert 'test/config_file' == config_instance.config['ansible'][
        'config_file']
    assert 'test/inventory_file' == config_instance.config['ansible'][
        'inventory_file']

Example 2

Project: molecule Source File: test_util.py
def test_resolve_template_dir_relative():
    result = util._resolve_template_dir('foo')

    parts = pytest.helpers.os_split(result)

    assert ('molecule', 'cookiecutter', 'foo') == parts[-3:]

Example 3

Project: molecule Source File: test_util.py
def test_resolve_template_dir_absolute():
    result = util._resolve_template_dir('/foo/bar')

    parts = pytest.helpers.os_split(result)

    assert ('foo', 'bar') == parts[-2:]

Example 4

Project: molecule Source File: test_ansible_lint.py
Function: test_execute
def test_execute(monkeypatch, patched_run_command, ansible_lint_instance):
    monkeypatch.setenv('HOME', '/foo/bar')
    ansible_lint_instance.execute()

    parts = pytest.helpers.os_split(ansible_lint_instance._playbook)
    assert 'playbook_data.yml' == parts[-1]

    x = sh.ansible_lint.bake(ansible_lint_instance._playbook, '--exclude .git',
                             '--exclude .vagrant', '--exclude .molecule')
    patched_run_command.assert_called_once_with(x, debug=None)

Example 5

Project: molecule Source File: test_goss.py
def test_goss_path(goss_instance):
    path = goss_instance._get_library_path()
    parts = pytest.helpers.os_split(path)

    assert ('verifier', os.path.pardir, os.path.pardir, 'molecule', 'verifier',
            'ansible', 'library') == parts[-7:]

Example 6

Project: molecule Source File: test_ansible_playbook.py
def test_parse_arg_playbook(ansible_playbook_instance):
    assert ansible_playbook_instance._cli.get('playbook') is None
    assert 'playbook_data.yml' == pytest.helpers.os_split(
        ansible_playbook_instance._playbook)[-1]

Example 7

Project: molecule Source File: test_goss.py
def test_get_library_path(goss_instance):
    path = goss_instance._get_library_path()
    parts = pytest.helpers.os_split(path)

    assert ('molecule', 'verifier', 'ansible', 'library') == parts[-4:]