-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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 Path.is_relative_to() #81870
Comments
Right now, to know whether a Path is relative to another one, you have to call Path.relative_to(), catch ValueError, and act in consequence. It would be nice to have a Path.is_relative_to() that does the equivalent for you and returns True/False. This is probably a good easy issue for a beginner contributor. |
antoine, let me try it;) |
Hi, Antoine, pls review this PR if you have free time. |
Path.is_relative() (as used in t/fixtures/programs.py) is a new feature as of Python 3.9, see https://docs.python.org/3.9/whatsnew/changelog.html?highlight=is_relative_to and python/cpython#81870 When running with an older python3 version, tests fail with: | env = {} | | def prepare_conf(env={}): | testenv = define_env(env) | ngcpcfg_path = testenv["NGCPCFG"] | > if not ngcpcfg_path.is_relative_to(CWD): | E AttributeError: 'PosixPath' object has no attribute 'is_relative_to' While python3-pytest depends on python3:any, let's keep the build dependency slim, by build-depending on the python3-minimal package only. Problem spotted while trying to debug the git safe.directory issue in an outdated bullseye based container, providing python3 3.7.5-3. Change-Id: Ib620a796a780817a81a51d791a766c950b1a541c
Path.is_relative() (as used in t/fixtures/programs.py) is a new feature as of Python 3.9, see https://docs.python.org/3.9/whatsnew/changelog.html?highlight=is_relative_to and python/cpython#81870 When running with an older python3 version, tests fail with: | env = {} | | def prepare_conf(env={}): | testenv = define_env(env) | ngcpcfg_path = testenv["NGCPCFG"] | > if not ngcpcfg_path.is_relative_to(CWD): | E AttributeError: 'PosixPath' object has no attribute 'is_relative_to' While python3-pytest depends on python3:any, let's keep the build dependency slim, by build-depending on the python3-minimal package only. Problem spotted while trying to debug the git safe.directory issue in an outdated bullseye based container, providing python3 3.7.5-3. Change-Id: Ib620a796a780817a81a51d791a766c950b1a541c
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: