Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add testing path to run_script commands #51583

Merged
merged 1 commit into from Feb 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion tests/support/case.py
Expand Up @@ -267,9 +267,15 @@ def run_script(self,
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)
Expand All @@ -286,7 +292,6 @@ def run_script(self,

tmp_file = tempfile.SpooledTemporaryFile()

popen_kwargs = popen_kwargs or {}
popen_kwargs = dict({
'shell': True,
'stdout': tmp_file,
Expand Down