kiwi-el8/test/unit/utils
Dan Čermák 48817a6441
Refactor Command class
Command.run() currently has a bit of a confusing behavior: if raise_on_error is
False and the executable is not found, then a weird CommandT is returned (return
code is -1 and stdout+stderr is None). This makes it possible to hanlde command
not found errors separately, but it makes that needlessly verbose. So instead,
let's just return None in *this* special case.

That in turn uncovered, that in most cases when we set `raise_on_error=True`, we
actually want an error if the command is not present but no error if the command
fails to execute (e.g. because it returns -1 if you run `$cmd --version`). Hence we
introduce the flag `raise_on_command_not_found`, which causes an exception to
be raised if the command is not found. This makes it independent of the
`raise_on_error` flag.

Additionally, we add a small optimization: if command starts with /, then we
assume it's a full path and we omit the call to which (and just check whether it
exists).

Co-authored-by: Marcus Schäfer <marcus.schaefer@gmail.com>
2024-02-19 16:33:24 +01:00
..
__init__.py Re-structure unit tests folders 2019-10-21 14:00:05 +02:00
block_test.py Use unittest.mock from core python everywhere 2024-02-18 22:15:30 +01:00
checksum_test.py Use unittest.mock from core python everywhere 2024-02-18 22:15:30 +01:00
codec_test.py Use unittest.mock from core python everywhere 2024-02-18 22:15:30 +01:00
command_capabilities_test.py Use unittest.mock from core python everywhere 2024-02-18 22:15:30 +01:00
compress_test.py Refactor Command class 2024-02-19 16:33:24 +01:00
fstab_test.py Support nose and xunit style tests 2022-02-26 20:26:18 +01:00
os_release_test.py Compat entry name for kernel-install in sd-boot 2024-01-13 23:25:41 +01:00
output_test.py Use unittest.mock from core python everywhere 2024-02-18 22:15:30 +01:00
primes_test.py Drop usage of factor from coreutils 2021-11-11 09:23:46 +01:00
rpm_database_test.py Use unittest.mock from core python everywhere 2024-02-18 22:15:30 +01:00
rpm_test.py Use unittest.mock from core python everywhere 2024-02-18 22:15:30 +01:00
signature_test.py Use unittest.mock from core python everywhere 2024-02-18 22:15:30 +01:00
size_test.py Re-structure unit tests folders 2019-10-21 14:00:05 +02:00
sync_test.py Use unittest.mock from core python everywhere 2024-02-18 22:15:30 +01:00
sysconfig_test.py Use unittest.mock from core python everywhere 2024-02-18 22:15:30 +01:00
temporary_test.py Use unittest.mock from core python everywhere 2024-02-18 22:15:30 +01:00
veritysetup_test.py Use unittest.mock from core python everywhere 2024-02-18 22:15:30 +01:00