Revert to the previous quoting behaviour for environment option
This commit is contained in:
@@ -62,7 +62,7 @@ test_command: 'pyproject'
|
||||
|
||||
default_build_options = options.build_options(identifier=None)
|
||||
|
||||
assert default_build_options.environment == parse_environment("FOO=BAR")
|
||||
assert default_build_options.environment == parse_environment('FOO="BAR"')
|
||||
|
||||
all_pinned_container_images = _get_pinned_container_images()
|
||||
pinned_x86_64_container_image = all_pinned_container_images["x86_64"]
|
||||
@@ -122,14 +122,19 @@ def test_passthrough_evil(tmp_path, monkeypatch, env_var_value):
|
||||
assert parsed_environment.as_dictionary(prev_environment={}) == {"ENV_VAR": env_var_value}
|
||||
|
||||
|
||||
xfail_env_parse = pytest.mark.xfail(
|
||||
raises=SystemExit, reason="until we can figure out the right way to quote these values"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"env_var_value",
|
||||
[
|
||||
"normal value",
|
||||
'"value wrapped in quotes"',
|
||||
'an unclosed double-quote: "',
|
||||
pytest.param('"value wrapped in quotes"', marks=[xfail_env_parse]),
|
||||
pytest.param('an unclosed double-quote: "', marks=[xfail_env_parse]),
|
||||
"string\nwith\ncarriage\nreturns\n",
|
||||
"a trailing backslash \\",
|
||||
pytest.param("a trailing backslash \\", marks=[xfail_env_parse]),
|
||||
],
|
||||
)
|
||||
def test_toml_environment_evil(tmp_path, monkeypatch, env_var_value):
|
||||
@@ -163,6 +168,9 @@ def test_toml_environment_evil(tmp_path, monkeypatch, env_var_value):
|
||||
('TEST_VAR="before:$PARAM:after"', "before:spam:after"),
|
||||
# env var extension with spaces
|
||||
('TEST_VAR="before $PARAM after"', "before spam after"),
|
||||
# literal $ - this test is just for reference, I'm not sure if this
|
||||
# syntax will work if we change the TOML quoting behaviour
|
||||
(r'TEST_VAR="before\\$after"', "before$after"),
|
||||
],
|
||||
)
|
||||
def test_toml_environment_quoting(tmp_path: Path, toml_assignment, result_value):
|
||||
|
||||
Reference in New Issue
Block a user