mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 03:41:25 -07:00
rework run_command's env setting to not change os.environ for the rest of the module.
New param to run_command to modify the environment for just this invocation. Documentation and comment adjustments.
This commit is contained in:
parent
e3a6accc1d
commit
a68d90a71a
2 changed files with 41 additions and 31 deletions
|
@ -39,6 +39,7 @@ class OpenStringIO(StringIO):
|
|||
def close(self):
|
||||
pass
|
||||
|
||||
|
||||
@unittest.skipIf(sys.version_info[0] >= 3, "Python 3 is not supported on targets (yet)")
|
||||
class TestAnsibleModuleRunCommand(unittest.TestCase):
|
||||
|
||||
|
@ -111,10 +112,6 @@ class TestAnsibleModuleRunCommand(unittest.TestCase):
|
|||
self.assertEqual(args, ('ls a " b" "c "', ))
|
||||
self.assertEqual(kwargs['shell'], True)
|
||||
|
||||
def test_path_prefix(self):
|
||||
self.module.run_command('foo', path_prefix='/opt/bin')
|
||||
self.assertEqual('/opt/bin', self.os.environ['PATH'].split(':')[0])
|
||||
|
||||
def test_cwd(self):
|
||||
self.os.getcwd.return_value = '/old'
|
||||
self.module.run_command('/bin/ls', cwd='/new')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue