Skip to content

Commit

Permalink
Execute test commands always with shell
Browse files Browse the repository at this point in the history
There is no need to handle tests on Windows and Unix differently here.
Always using a shell allows for more flexibility when writing tests.
  • Loading branch information
webmeister committed Dec 9, 2020
1 parent 97b81ba commit 4aec84e
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions tests/system_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,17 @@
import inspect
import subprocess
import threading
import shlex
import sys
import shutil
import string
import unittest


if sys.platform == 'win32':
#: invoke subprocess.Popen with shell=True on Windows
_SUBPROCESS_SHELL = True

def _cmd_splitter(cmd):
return cmd

def _process_output_post(output):
return output.replace('\r\n', '\n')

else:
#: invoke subprocess.Popen with shell=False on Unix
_SUBPROCESS_SHELL = False

def _cmd_splitter(cmd):
return shlex.split(cmd)

def _process_output_post(output):
return output

Expand Down Expand Up @@ -551,13 +538,13 @@ def test_run(self):
)

proc = subprocess.Popen(
_cmd_splitter(command),
command,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
stdin=subprocess.PIPE if stdin is not None else None,
env=self._get_env(),
cwd=self.work_dir,
shell=_SUBPROCESS_SHELL
shell=True,
)

# Setup a threading.Timer which will terminate the command if it takes
Expand Down

0 comments on commit 4aec84e

Please sign in to comment.