How to split the string -s -k "test_a or test_b" -m "not unstable" --results=/tmp/test-results --log-cli-level=INFO
to
['-s', '-k', 'test_a or test_b', '-m', 'not unstable', '--results=/tmp/test-results', '--log-cli-level=INFO']
How to split the string -s -k "test_a or test_b" -m "not unstable" --results=/tmp/test-results --log-cli-level=INFO
to
['-s', '-k', 'test_a or test_b', '-m', 'not unstable', '--results=/tmp/test-results', '--log-cli-level=INFO']
I'm assuming you missed addding a quote. If you want to split with shell-like behaviour, use shlex
:
import shlex
s = '-s -k "test_a or test_b" -m "not unstable" --results=/tmp/test-results --log-cli-level=INFO'
print(shlex.split(s))
# ['-s', '-k', 'test_a or test_b', '-m', 'not unstable', '--results=/tmp/test-results', '--log-cli-level=INFO']