tests: add regression tests for 'west list manifest'

Verify the expected behavior related to printing path-related
attributes for the manifest project.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
Martí Bolívar 2020-08-07 14:36:24 -07:00 committed by Marti Bolivar
parent 0bcfad5ce2
commit 27c2dd02c9
1 changed files with 27 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import collections
import os
import re
import shlex
import shutil
import subprocess
import textwrap
from pathlib import Path, PurePath
@ -118,6 +119,32 @@ def test_list(west_update_tmpdir):
cmd('list NOT_A_PROJECT')
def test_list_manifest(west_update_tmpdir):
# The manifest's "self: path:" should only be used to print
# path-type format strings with --manifest-path-from-yaml.
os.mkdir('manifest_moved')
shutil.copy('zephyr/west.yml', 'manifest_moved/west.yml')
cmd('config manifest.path manifest_moved')
path = cmd('list -f "{path}" manifest').strip()
abspath = cmd('list -f "{abspath}" manifest').strip()
posixpath = cmd('list -f "{posixpath}" manifest').strip()
assert path == 'manifest_moved'
assert Path(abspath) == west_update_tmpdir / 'manifest_moved'
assert posixpath == Path(west_update_tmpdir).as_posix() + '/manifest_moved'
path = cmd('list --manifest-path-from-yaml '
'-f "{path}" manifest').strip()
abspath = cmd('list --manifest-path-from-yaml '
'-f "{abspath}" manifest').strip()
posixpath = cmd('list --manifest-path-from-yaml '
'-f "{posixpath}" manifest').strip()
assert path == 'zephyr'
assert Path(abspath) == Path(str(west_update_tmpdir / 'zephyr'))
assert posixpath == Path(west_update_tmpdir).as_posix() + '/zephyr'
def test_manifest_freeze(west_update_tmpdir):
# We should be able to freeze manifests.
actual = cmd('manifest --freeze').splitlines()