mirror of
https://github.com/TheLocehiliosan/yadm
synced 2024-10-27 20:34:27 +00:00
e7f9616b39
The new test system is written with py.test. These tests are more comprehensive, run faster by an order of magnitude, and are far more maintainable. The tests themselves conform to PEP8.
27 lines
693 B
Python
27 lines
693 B
Python
"""Unit tests: query_distro"""
|
|
|
|
|
|
def test_lsb_release_present(runner, yadm, tst_distro):
|
|
"""Match lsb_release -si when present"""
|
|
script = f"""
|
|
YADM_TEST=1 source {yadm}
|
|
query_distro
|
|
"""
|
|
run = runner(command=['bash'], inp=script)
|
|
assert run.success
|
|
assert run.err == ''
|
|
assert run.out.rstrip() == tst_distro
|
|
|
|
|
|
def test_lsb_release_missing(runner, yadm):
|
|
"""Empty value when missing"""
|
|
script = f"""
|
|
YADM_TEST=1 source {yadm}
|
|
LSB_RELEASE_PROGRAM="missing_lsb_release"
|
|
query_distro
|
|
"""
|
|
run = runner(command=['bash'], inp=script)
|
|
assert run.success
|
|
assert run.err == ''
|
|
assert run.out.rstrip() == ''
|