AcademySoftwareFoundation / AcademySoftwareFoundation/rez
windows: path-separator issues using {root} with package attribute tests={}
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 369
- Avg merge
- 12d 3h
- Merged PRs (30d)
- 5
Description
Hey guys,
On windows, where `os.normpath()` prefers back-slashes to forward slashes I ran into an issue:
``` python
# package.py
tests = {
'unit':{
'command': 'pytest -o "testpaths={root}/tests"',
'requires': ['pytest'],
}
}
```
```
Running test command: pytest -o "testpaths=C:\Users\vagrant\Documents\packages\testpkg\0.0.1/tests"
ERROR: file not found: C:Usersvagrantpackagestestpkg0.0.1/tests
```
____
I tried sneaking around it and using `'command': 'pytest -o "testpaths={}/tests"'.format( '{root}'.replace('\\','/') )`` , but I'm guessing that the python code is run before the preprocessor.
I was wondering if any of you had any ideas to work around the unescaped backslashes. Thanks again for all of the help,
Will
Contributor guide
Research direction
Start with the package.py example and reproduce the shown pytest command on Windows. Trace how {root} is expanded and how path separators are normalized before the package attribute command runs. Done means the generated testpaths value remains a valid Windows path and the example command locates its tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100