xonsh/tests/procs/test_jobs.py
Andy Kipp 4913edca7a
refactoring: move tests to component dirs: lib, procs (#5558)
https://github.com/xonsh/xonsh/issues/5538

## For community
⬇️ **Please click the 👍 reaction instead of leaving a `+1` or 👍
comment**

---------

Co-authored-by: a <1@1.1>
2024-06-29 11:23:16 +02:00

36 lines
865 B
Python

import pytest
from xonsh.procs import jobs
@pytest.mark.parametrize(
"args, prefix, exp",
[
(
"disown",
"-",
{"-h", "--help", "-c", "--continue"},
),
(
"disown",
"",
{"1", "2"},
),
],
)
def test_disown_completion(
args, prefix, exp, xsh_with_aliases, monkeypatch, check_completer
):
job = {
"cmds": (["git-cola", "2>", "/dev/null"], "&"),
"pids": [37078],
"bg": True,
"pgrp": None,
"started": 1630158319.697764,
"status": "running",
}
all_jobs = {1: job, 2: job}
monkeypatch.setattr(jobs._jobs_thread_local, "jobs", all_jobs, raising=False)
monkeypatch.setattr(jobs._jobs_thread_local, "tasks", [2, 1], raising=False)
assert check_completer(args, prefix=prefix) == exp