2021-02-09 07:34:26 +08:00
|
|
|
import os
|
2020-08-19 06:41:34 +08:00
|
|
|
import subprocess
|
|
|
|
import sys
|
|
|
|
|
|
|
|
import west.version
|
|
|
|
|
2021-02-09 07:34:26 +08:00
|
|
|
assert 'TOXTEMPDIR' in os.environ, "you must run these tests using tox"
|
|
|
|
|
2020-08-19 06:41:34 +08:00
|
|
|
def test_main():
|
|
|
|
# A quick check that the package can be executed as a module which
|
|
|
|
# takes arguments, using e.g. "python3 -m west --version" to
|
|
|
|
# produce the same results as "west --version", and that both are
|
|
|
|
# sane (i.e. the actual version number is printed instead of
|
|
|
|
# simply an error message to stderr).
|
|
|
|
|
|
|
|
output_as_module = subprocess.check_output([sys.executable, '-m', 'west',
|
|
|
|
'--version']).decode()
|
|
|
|
output_directly = subprocess.check_output(['west', '--version']).decode()
|
|
|
|
assert west.version.__version__ in output_as_module
|
|
|
|
assert output_as_module == output_directly
|