From 774963e582ee5780f94090a000fff06674f1ec17 Mon Sep 17 00:00:00 2001 From: brycegbrazen Date: Tue, 23 Jul 2024 16:17:34 -0500 Subject: [PATCH] Add failing unit test Signed-off-by: brycegbrazen Signed-off-by: Jean-Christophe Morin --- src/rez/tests/test_shells.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/rez/tests/test_shells.py b/src/rez/tests/test_shells.py index 114497089..a05688730 100644 --- a/src/rez/tests/test_shells.py +++ b/src/rez/tests/test_shells.py @@ -607,6 +607,22 @@ def _make_alias(ex): out, _ = p.communicate() self.assertEqual(1, p.returncode) + @per_available_shell() + def test_alias_non_existent_command_return_code(self, shell): + """Ensure return codes are correct while using aliases.""" + config.override("default_shell", shell) + + def _make_alias(ex): + ex.alias('my_alias', 'a_non_existent_executable') + + r = self._create_context([]) + p = r.execute_shell(command='my_alias', + actions_callback=_make_alias, + stdout=subprocess.PIPE) + + out, _ = p.communicate() + self.assertNotEqual(0, p.returncode) + if __name__ == '__main__': unittest.main()