Ejemplo n.º 1
0
def test_Pluma_create_target_context_should_warn_if_variable_overwritten_by_env(
        capsys, monkeypatch):
    monkeypatch.setenv('mymessage', 'env message')

    Pluma.create_target_context(config_file_path('variable-sub-target'))
    stdout = capsys.readouterr().out

    assert f'"mymessage" defined in both environment variables and target config.{os.linesep}    Using environment: env message' in stdout
Ejemplo n.º 2
0
def test_Pluma_create_target_context_variables_should_reflect_env_vars(
        monkeypatch):
    monkeypatch.setenv('abc', 'def')

    context = Pluma.create_target_context(config_file_path('minimal-target'))

    assert context.variables['abc'] == 'def'
Ejemplo n.º 3
0
def test_Pluma_create_target_context_env_vars_should_override_target_variables(
        monkeypatch):
    monkeypatch.setenv('mymessage', 'env message')

    context = Pluma.create_target_context(
        config_file_path('variable-sub-target'))

    assert context.variables['mymessage'] == 'env message'
Ejemplo n.º 4
0
def test_Pluma_create_target_context_env_vars_should_override_target_variables(monkeypatch):
    monkeypatch.setenv('mymessage', 'env message')

    env_vars = dict(os.environ)
    config = Pluma.load_config_file(config_file_path('variable-sub-target'), 'Target Config',
                                    env_vars)
    context = Pluma.create_target_context(config, env_vars)

    assert context.variables['mymessage'] == 'env message'
Ejemplo n.º 5
0
def test_Pluma_create_target_context_variables_should_reflect_env_vars(monkeypatch):
    monkeypatch.setenv('abc', 'def')

    env_vars = dict(os.environ)
    config = Pluma.load_config_file(config_file_path('minimal-target'), 'Target Config',
                                    env_vars)
    context = Pluma.create_target_context(config, env_vars)

    assert context.variables['abc'] == 'def'
Ejemplo n.º 6
0
def test_Pluma_create_target_context_env_vars_should_override_target_variables(
):
    env = dict(os.environ)
    try:
        os.environ['mymessage'] = 'env message'
        context = Pluma.create_target_context(
            config_file_path('variable-sub-target'))
        assert context.variables['mymessage'] == 'env message'
    finally:
        os.environ.clear()
        os.environ.update(env)
Ejemplo n.º 7
0
def test_Pluma_create_target_context_variables_should_reflect_env_vars():
    env = dict(os.environ)
    try:
        os.environ['abc'] = 'def'
        context = Pluma.create_target_context(
            config_file_path('minimal-target'))

        assert context.variables['abc'] == 'def'
    finally:
        os.environ.clear()
        os.environ.update(env)
Ejemplo n.º 8
0
def test_Pluma_create_target_context_should_parse_target_variables():
    context = Pluma.create_target_context(
        config_file_path('variable-sub-target'))
    assert context.variables['mymessage'] == 'echo hello script!'
Ejemplo n.º 9
0
def test_Pluma_create_target_context_should_parse_target_variables():
    env_vars = dict(os.environ)
    config = Pluma.load_config_file(config_file_path('variable-sub-target'), 'Target Config',
                                    env_vars)
    context = Pluma.create_target_context(config, env_vars)
    assert context.variables['mymessage'] == 'echo hello script!'