Closed worldworm closed 4 months ago
Hey @worldworm, thanks for contributing this fix! It looks good.
It might be a good idea to add a test case for this to make sure it stays fixed: https://github.com/nat-n/poethepoet/blob/main/tests/test_poetry_plugin.py What do you think?
Oh, that's an excellent idea. I totally forgot about those. 😄
Unfortunately, after several attempts, I still haven't managed to get the test cases green. The --directory
command doesn't seem to be recognized.
I have a feeling that it might have something to do with the older version of poetry that is used for the test cases.
https://github.com/nat-n/poethepoet/blob/7fecb34a0479bfe4250971e6524b22b9971fd6e5/tests/conftest.py#L257
I'll take a closer look tomorrow and get back to you.
Indeed, hopefully it's easy to update the poetry version for testing!
So, it seems to me that the attribute from which I organised the path (application.poetry.pyproject_path
) was introduced in a newer poetry version that is > 1.2.1. That explains why i had no success with test cases yesterday.
I have now simply downloaded a new poetry version (the wheel directly from here). If I understand correctly, this is only used for the test cases and should therefore have no effect on other things.
However, this shows that my changes are not breaking changes, as in the case of an older poetry version my except statement applies and the cwd is calculated as before. 😃
https://github.com/nat-n/poethepoet/discussions/209
With a bit of tinkering, I found
application.poetry.pyproject_path
. This contains the path to pyproject.tomlUsing the example of #209: Running
poetry --directory backend install
from the dirproject/
the attributeapplication.poetry.pyproject_path
has the valuebackend/pyproject.toml
Runningpoetry install
from the dirproject/backend/
the attributeapplication.poetry.pyproject_path
has the value/project/backend/pyproject.toml
I hope I haven't missed anything essential 😃