mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 00:14:41 +01:00
tests: SpecAttrModifierAlias: integration test (#5533)
Added test. ## For community ⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍 comment** --------- Co-authored-by: a <1@1.1> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
3e41a744d4
commit
d351df384a
1 changed files with 20 additions and 0 deletions
|
@ -1331,6 +1331,26 @@ def test_alias_stability():
|
|||
assert re.match(".*sleep.*sleep.*sleep.*", out, re.MULTILINE | re.DOTALL)
|
||||
|
||||
|
||||
@skip_if_on_windows
|
||||
@pytest.mark.flaky(reruns=3, reruns_delay=1)
|
||||
def test_spec_modifier_alias():
|
||||
"""Testing spec modifier alias with `@` in the alias name."""
|
||||
stdin_cmd = (
|
||||
"from xonsh.procs.specs import SpecAttrModifierAlias as mod\n"
|
||||
'aliases["@dict"] = mod({"output_format": lambda lines: eval("\\n".join(lines))})\n'
|
||||
"d = $(@dict echo '{\"a\":42}')\n"
|
||||
"print('Answer =', d['a'])\n"
|
||||
)
|
||||
out, err, ret = run_xonsh(
|
||||
cmd=None,
|
||||
stdin_cmd=stdin_cmd,
|
||||
interactive=True,
|
||||
single_command=False,
|
||||
timeout=10,
|
||||
)
|
||||
assert "Answer = 42" in out
|
||||
|
||||
|
||||
@skip_if_on_windows
|
||||
@pytest.mark.flaky(reruns=3, reruns_delay=1)
|
||||
def test_alias_stability_exception():
|
||||
|
|
Loading…
Add table
Reference in a new issue