From c7b369a7be37094e41a1737eb2057caf0245392e Mon Sep 17 00:00:00 2001 From: DanielChabrowski Date: Tue, 19 Mar 2019 09:30:18 +0100 Subject: [PATCH] Add test for xargs propagating kwargs to cmd_output --- tests/xargs_test.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/xargs_test.py b/tests/xargs_test.py index a6cffd72..71f5454c 100644 --- a/tests/xargs_test.py +++ b/tests/xargs_test.py @@ -208,3 +208,13 @@ def test_thread_mapper_concurrency_uses_threadpoolexecutor_map(): def test_thread_mapper_concurrency_uses_regular_map(): with xargs._thread_mapper(1) as thread_map: assert thread_map is map + + +def test_xargs_propagate_kwargs_to_cmd(): + env = {'PRE_COMMIT_TEST_VAR': 'Pre commit is awesome'} + cmd = ('bash', '-c', 'echo $PRE_COMMIT_TEST_VAR', '--') + cmd = parse_shebang.normalize_cmd(cmd) + + ret, stdout, _ = xargs.xargs(cmd, ('1',), env=env) + assert ret == 0 + assert b'Pre commit is awesome' in stdout