treefmt / nix fmt (pull_request) Successful in 6s
pytest / pytest (pull_request) Successful in 26s
build_systems / build-brain (pull_request) Successful in 47s
build_systems / build-bob (pull_request) Successful in 48s
build_systems / build-rhapsody-in-green (pull_request) Successful in 59s
build_systems / build-jeeves (pull_request) Successful in 2m32s
Move signal_alert out of python/common.py into a dedicated python/signal_alert.py module and update its importers (validate_system.py, snapshot_manager.py) to the new path. Relocate the signal_alert tests from tests/test_common.py into tests/test_signal_alert.py, repatching python.signal_alert.logger and python.signal_alert.Apprise to match the new module.
26 lines
667 B
Python
26 lines
667 B
Python
"""test_common."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from python.common import bash_wrapper, utcnow
|
|
|
|
|
|
def test_utcnow() -> None:
|
|
"""test_utcnow."""
|
|
utcnow()
|
|
|
|
|
|
def test_test_bash_wrapper() -> None:
|
|
"""test_test_bash_wrapper."""
|
|
stdout, returncode = bash_wrapper("echo test")
|
|
assert stdout == "test\n"
|
|
assert returncode == 0
|
|
|
|
|
|
def test_test_bash_wrapper_error() -> None:
|
|
"""test_test_bash_wrapper_error."""
|
|
expected_error = 2
|
|
stdout, returncode = bash_wrapper("ls /this/path/does/not/exist")
|
|
assert stdout == "ls: cannot access '/this/path/does/not/exist': No such file or directory\n"
|
|
assert returncode == expected_error
|