specter-desktop/tests/test_util_shell.py
k9ert ef364ce1bc
Chore: refurbish release infrastructure (#2198)
* change release infra

* syntax error

* fix buildscript (hopefully)

* fix pip generation too

* fix build (hopefully)

* fix bloated sdid (mainly MANIFEST.in)

* adjust tests, remove importlib_meta

* fix dependency issue in release jobs

* fix tests and remove pytest.ini entirely

* fix install_noded script

* fix test

* fix tests

* stupid versioin parsing does not work!

* try to fix version guessing

* and again
2023-02-15 14:58:33 +01:00

29 lines
855 B
Python

import logging
def test_which(caplog):
caplog.set_level(logging.INFO)
caplog.set_level(logging.DEBUG, logger="cryptoadvance.specter")
import cryptoadvance.specter.util.shell as helpers
try:
helpers.which("some_non_existing_binary")
assert False, "Should raise an Exception"
except:
pass
assert (
helpers.which("date") == "/bin/date" or helpers.which("date") == "/usr/bin/date"
) # travis-CI has it on /bin/date
def test_last_lines(caplog):
from cryptoadvance.specter.util.shell import get_last_lines_from_file
lines = get_last_lines_from_file("LICENSE", 30)
assert lines[-2].startswith("OUT OF OR IN CONNECTION WITH THE SOFTWARE ")
def test_grep():
from cryptoadvance.specter.util.shell import grep
assert grep("./pyproject.toml", 'name = "cryptoadvance.specter"')