File: test_request.py

package info (click to toggle)
tox 4.25.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,032 kB
  • sloc: python: 18,531; sh: 22; makefile: 14
file content (26 lines) | stat: -rw-r--r-- 714 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
from __future__ import annotations

import os
import sys
from pathlib import Path

import pytest

from tox.execute.request import ExecuteRequest, StdinSource


def test_execute_request_raise_on_empty_cmd(os_env: dict[str, str]) -> None:
    with pytest.raises(ValueError, match="cannot execute an empty command"):
        ExecuteRequest(cmd=[], cwd=Path().absolute(), env=os_env, stdin=StdinSource.OFF, run_id="")


def test_request_allow_star_is_none() -> None:
    request = ExecuteRequest(
        cmd=[sys.executable],
        cwd=Path.cwd(),
        env={"PATH": os.environ["PATH"]},
        stdin=StdinSource.OFF,
        run_id="run-id",
        allow=["*", "magic"],
    )
    assert request.allow is None