Feat/source roots option#323
Conversation
|
@seddonym can you please advise on which tests you feel are necessary and how they should be organized? |
There was a problem hiding this comment.
Thanks for the PR!
It's looking pretty good, but prior to this it has always been possible to unit test use cases by configuring test doubles. We probably need to do something about the Python path in the same way. I'll have a think about the best way to handle it in this case and get back to you (should only be a small tweak).
|
Actually I've realised we do something like this already in one of my other packages, Impulse. https://github.com/seddonym/impulse/blob/main/tests/unit/application/test_use_cases.py#L68 Here, we pass sys.path into the function (optionally), allowing us to test it without mocking. Do you feel comfortable in making that change? If not I can do it. |
|
@seddonym - I'm sorry for letting this go stale. Please let me know if you agree on the below points. Given the merge conflict, I think it would be best for me to open a fresh PR with these changes, rather than try to detangle the conflicts. And just to make sure I understand your ask. You would you like me to inject Current: def _modify_path(user_options: UserOptions) -> None:Preferred: def _modify_path(user_options: UserOptions, sys_path: list[str] | None = None) -> None: |
|
Sorry for delay, had to refresh my memory on this too. Looking a bit more closely I realize we have a different mechanism for injecting test doubles than we use for the library I shared with you - here, we have a It should be simple - something along these lines:
Rather than testing |
This pull request resolves #274 by introducing support for a new
source_rootsconfiguration option, allowing users to specify additional directories to be added to the Python import search path. This is particularly useful for projects using asrc/layout or monorepos with multiple package roots. The changes include updates to documentation, release notes, logic, and tests to ensure correct handling of the new option.just check. (see note below)docs/release_notes.md.docs/authors.md(in alphabetical order).Note: The
just checkcommand as currently configured requests Python 3.9 which contradictsrequires-python = ">=3.10"inpyproject.toml. I ranjust check(excludingjust test-all), and manually executed only the relevant tests withfor v in 10 11 12 13 14; do just "test-3-$v"; done. Also, there is an issue with parallel test execution because it consistently failed on my machine.