mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Add testing path to run_script commands
This commit is contained in:
parent
2d8a3641bc
commit
5351e5c459
@ -267,9 +267,15 @@ class ShellTestCase(TestCase, AdaptedConfigurationTestCaseMixin):
|
|||||||
script_path = self.get_script_path(script)
|
script_path = self.get_script_path(script)
|
||||||
if not os.path.isfile(script_path):
|
if not os.path.isfile(script_path):
|
||||||
return False
|
return False
|
||||||
|
popen_kwargs = popen_kwargs or {}
|
||||||
|
|
||||||
if salt.utils.platform.is_windows():
|
if salt.utils.platform.is_windows():
|
||||||
cmd = 'python '
|
cmd = 'python '
|
||||||
|
if 'cwd' not in popen_kwargs:
|
||||||
|
popen_kwargs['cwd'] = os.getcwd()
|
||||||
|
if 'env' not in popen_kwargs:
|
||||||
|
popen_kwargs['env'] = os.environ.copy()
|
||||||
|
popen_kwargs['env'][b'PYTHONPATH'] = os.getcwd().encode()
|
||||||
else:
|
else:
|
||||||
cmd = 'PYTHONPATH='
|
cmd = 'PYTHONPATH='
|
||||||
python_path = os.environ.get('PYTHONPATH', None)
|
python_path = os.environ.get('PYTHONPATH', None)
|
||||||
@ -286,7 +292,6 @@ class ShellTestCase(TestCase, AdaptedConfigurationTestCaseMixin):
|
|||||||
|
|
||||||
tmp_file = tempfile.SpooledTemporaryFile()
|
tmp_file = tempfile.SpooledTemporaryFile()
|
||||||
|
|
||||||
popen_kwargs = popen_kwargs or {}
|
|
||||||
popen_kwargs = dict({
|
popen_kwargs = dict({
|
||||||
'shell': True,
|
'shell': True,
|
||||||
'stdout': tmp_file,
|
'stdout': tmp_file,
|
||||||
|
Loading…
Reference in New Issue
Block a user