-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
feat(cli)!: actually switch directory with --directory/-C #9831
Conversation
2b8a3b6
to
85d74a7
Compare
Deploy preview for website ready! ✅ Preview Built with commit e5e553b. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add some sort of test for the new option?
I really would like to add some tests. But until now I wasn't able to do so because I don't know how. The scenario I have in mind goes like this:
So any help is appreciated 😃 |
Most similar test is probably poetry/tests/console/commands/test_run.py Line 153 in 341071a
which runs a scripts entrypoint and checks the error output. In https://github.com/python-poetry/poetry/tree/main/tests/fixtures/scripts, there is a project, which already has some entry points. There, you can add another one. |
Thanks @radoering. 👍 I played around a while, but due to the creation of venv I find it to complicated. In finally choose the |
805c746
to
6322aa7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the expected behaviour when user passes both --project
and --directory
? I feel like there should be some more info on that matter, it doesn't feel intuitive right now and the docs are quite vague on the difference between those two.
I did not check, but my expectation is that the working directory is changed but the pyproject.toml is searched in
I agree it makes sense to add a sentence about this special case. Maybe, we should even add a test case where both parameters are used. |
6322aa7
to
f4459cb
Compare
I've added a test case. Any suggestion for extending the docs? |
Maybe an info box below the global options. However, while thinking about what to write I did not come up with something that is saying more than what has already been added in #9831 (comment). Maybe, that is sufficient. |
f4459cb
to
e5e553b
Compare
Pull Request Check List
--directory
now switch the current working folder, so that relative paths are resolved relative to the given folder.To retain the old behavior the
--project
flag is introduced.Resolves: #7897