mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #51583 from dwoz/scriptfix
Add testing path to run_script commands
This commit is contained in:
commit
f446c52584
1 changed files with 6 additions and 1 deletions
|
@ -267,9 +267,15 @@ class ShellTestCase(TestCase, AdaptedConfigurationTestCaseMixin):
|
|||
script_path = self.get_script_path(script)
|
||||
if not os.path.isfile(script_path):
|
||||
return False
|
||||
popen_kwargs = popen_kwargs or {}
|
||||
|
||||
if salt.utils.platform.is_windows():
|
||||
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:
|
||||
cmd = 'PYTHONPATH='
|
||||
python_path = os.environ.get('PYTHONPATH', None)
|
||||
|
@ -286,7 +292,6 @@ class ShellTestCase(TestCase, AdaptedConfigurationTestCaseMixin):
|
|||
|
||||
tmp_file = tempfile.SpooledTemporaryFile()
|
||||
|
||||
popen_kwargs = popen_kwargs or {}
|
||||
popen_kwargs = dict({
|
||||
'shell': True,
|
||||
'stdout': tmp_file,
|
||||
|
|
Loading…
Add table
Reference in a new issue