From 7b316c941a9c98f919b1e7e1d706b10fcb493a69 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Fri, 8 Nov 2024 14:56:28 +0100 Subject: [PATCH] tests: Format test_alias.py Formatting test_alias.py is trivial. Signed-off-by: Pieter De Gendt --- tests/test_alias.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_alias.py b/tests/test_alias.py index 88ad7e45..0f7bf39f 100644 --- a/tests/test_alias.py +++ b/tests/test_alias.py @@ -10,6 +10,7 @@ assert 'TOXTEMPDIR' in os.environ, "you must run these tests using tox" + @pytest.fixture(autouse=True) def autouse_tmpdir(config_tmpdir, west_init_tmpdir): # Since this module tests west's configuration file features, @@ -17,6 +18,7 @@ def autouse_tmpdir(config_tmpdir, west_init_tmpdir): # saves typing and is less error-prone than using it below in every test case. pass + def test_alias_commands(): cmd('config alias.test1 topdir') cmd('config --global alias.test2 topdir') @@ -28,6 +30,7 @@ def test_alias_commands(): assert cmd('test2') == topdir_out assert cmd('test3') == topdir_out + def test_alias_help(): cmd('config alias.test topdir') @@ -36,6 +39,7 @@ def test_alias_help(): assert "An alias that expands to: topdir" in help_out assert cmd('-h test') == help_out + def test_alias_recursive_commands(): list_format = '{revision} TESTALIAS {name}' cmd(['config', 'alias.test1', f'list -f "{list_format}"']) @@ -43,6 +47,7 @@ def test_alias_recursive_commands(): assert cmd('test2') == cmd(['list', '-f', list_format]) + def test_alias_infinite_recursion(): cmd('config alias.test1 test2') cmd('config alias.test2 test3') @@ -53,6 +58,7 @@ def test_alias_infinite_recursion(): assert 'unknown command "test1";' in str(excinfo.value.stdout) + def test_alias_empty(): cmd(['config', 'alias.empty', '']) @@ -64,18 +70,21 @@ def test_alias_empty(): assert 'empty alias "empty"' in str(excinfo.value.stdout) + def test_alias_early_args(): cmd('config alias.test1 topdir') # An alias with an early command argument shouldn't fail assert "Replacing alias test1 with ['topdir']" in cmd('-v test1') + def test_alias_command_with_arguments(): list_format = '{revision} TESTALIAS {name}' cmd(['config', 'alias.revs', f'list -f "{list_format}"']) assert cmd('revs') == cmd(['list', '-f', list_format]) + def test_alias_override(): before = cmd('list') list_format = '{name} : {revision}'