Files
dotfiles/tests/test_common.py
T
Richie 37f37c41ac
treefmt / nix fmt (pull_request) Successful in 5s
pytest / pytest (pull_request) Successful in 24s
build_systems / build-brain (pull_request) Successful in 44s
build_systems / build-bob (pull_request) Successful in 44s
build_systems / build-rhapsody-in-green (pull_request) Successful in 57s
build_systems / build-jeeves (pull_request) Successful in 2m17s
treefmt / nix fmt (push) Successful in 5s
build_systems / build-brain (push) Successful in 8s
pytest / pytest (push) Successful in 23s
build_systems / build-bob (push) Successful in 30s
build_systems / build-rhapsody-in-green (push) Successful in 42s
build_systems / build-jeeves (push) Successful in 2m2s
feat(common): add get_repo_dir function and corresponding tests
2026-07-12 14:24:05 -04:00

33 lines
883 B
Python

"""test_common."""
from __future__ import annotations
from python.common import bash_wrapper, get_repo_dir, utcnow
def test_get_repo_dir() -> None:
"""test_get_repo_dir."""
repo_dir = get_repo_dir()
assert (repo_dir / "pyproject.toml").is_file()
assert (repo_dir / "python" / "common.py").is_file()
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