File: test_jobs.py

package info (click to toggle)
xonsh 0.13.4%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,024 kB
  • sloc: python: 46,350; makefile: 136; sh: 41; xml: 17
file content (36 lines) | stat: -rw-r--r-- 859 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import pytest

from xonsh 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