Some checks failed
Code Quality Main / code-quality (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
Tests / run_tests_ubuntu (ubuntu-latest, 3.10) (push) Has been cancelled
Tests / run_tests_ubuntu (ubuntu-latest, 3.8) (push) Has been cancelled
Tests / run_tests_ubuntu (ubuntu-latest, 3.9) (push) Has been cancelled
Tests / run_tests_macos (macos-latest, 3.10) (push) Has been cancelled
Tests / run_tests_macos (macos-latest, 3.8) (push) Has been cancelled
Tests / run_tests_macos (macos-latest, 3.9) (push) Has been cancelled
Tests / run_tests_windows (windows-latest, 3.10) (push) Has been cancelled
Tests / run_tests_windows (windows-latest, 3.8) (push) Has been cancelled
Tests / run_tests_windows (windows-latest, 3.9) (push) Has been cancelled
Tests / code-coverage (push) Has been cancelled
22 lines
498 B
Python
22 lines
498 B
Python
import pytest
|
|
from beartype.typing import List
|
|
|
|
from tests.helpers.package_available import _SH_AVAILABLE
|
|
|
|
if _SH_AVAILABLE:
|
|
import sh
|
|
|
|
|
|
def run_sh_command(command: List[str]) -> None:
|
|
"""Default method for executing shell commands with `pytest` and `sh` package.
|
|
|
|
:param command: A list of shell commands as strings.
|
|
"""
|
|
msg = None
|
|
try:
|
|
sh.python(command)
|
|
except sh.ErrorReturnCode as e:
|
|
msg = e.stderr.decode()
|
|
if msg:
|
|
pytest.fail(msg=msg)
|