From 27c2dd02c9844b151630989f5c8445b4b8ed36f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Bol=C3=ADvar?= Date: Fri, 7 Aug 2020 14:36:24 -0700 Subject: [PATCH] tests: add regression tests for 'west list manifest' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Verify the expected behavior related to printing path-related attributes for the manifest project. Signed-off-by: Martí Bolívar --- tests/test_project.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/test_project.py b/tests/test_project.py index 2a8430f..52ae7fc 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -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()