Closed jgirardet closed 5 years ago
expand
takes a (str|List|Dict)
as first argument.
The idea is
pytest = '$folder'
shlex.split('$folder') #=> ['$folder']
expand(['$folder'], vars) #=> ['/my fol/der /with /spaces']
but if you do it the other way
expand('$folder') #=> '/my fol/der /with /spaces'
shlex.split('/my fol/der /with /spaces') #=> ['/my', 'fol/der', '/with', '/spaces']
_expand/expand_variables was confusing to me. I'll look at it tomorrow or maybe next week.
Hi, I was thinking to it seems that the thing is not so simple to do:
2 use cases about pytest parameter: a- /my folder/whit spaces/pytest # expandable b- poetry|pipenv|... run pytest #no expand should be needed
Mix of two seems not very useful. depending the case you want to split space or not but it's not easy to guess.
My proposal :
Yes, you're correct.
Otherwise, we want to support
a) 'pytest.exe' b) 'C:\path to\my venvs\$project_name\Scripts\pytest' c) '$folder\Scripts\pytest' d) 'poetry run pytest'
For b and c we cannot split at all! Thanks for ppointing that out.
We also can't split .\.venv\Scripts\pytest
(relative paths to the working dir). So, I suppose we just don't do it at all. Instead of 'poetry run pytest' users have to spell that ['poetry', 'run', 'pytest']
in the settings.
I miss something. If you split first, How do you expand ?