1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-06-29 23:49:09 +00:00

Merge pull request #14025 from ansible/run_command-env-rework

rework run_command's env setting to not change os.environ for the res…
This commit is contained in:
Toshio Kuratomi 2016-01-20 12:13:43 -08:00
commit d97d28ecb0
2 changed files with 41 additions and 31 deletions

View file

@ -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')