✅ Use custom changing_dir instead of CLIRunner.isolated_filesystem to set working dir#15616
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
Just to add, if we prefer to bring back CLIRunner.isolated_filesystem that's possible too. In Typer we could resolve all of its usages with tmp_path which is why I originally ended up removing it, but I don't feel strongly either way.
If we want to restore it, I can easily do so in fastapi/typer#1792, just let me know 🙂
There was a problem hiding this comment.
Thank you! 🚀
And I personally agree with just dropping isolated_filesystem, I would think if people need that, it would make more sense to use tmp_path from pytest or similar, I don't really think the CLI should provide that utility as that can come from testing utilities. I also suspect it was added to Click before there were any other options, but for us is probably safe to not have to keep supporting it.
Description
Typer 0.26 removed
CLIRunner.isolated_filesystemcontext manager that was used in tests to set working directory to temporary path.So, FastAPI redistribute tests started to fail (they run with latest dependency versions) - see logs.
Here is where
isolated_filesystemis used:fastapi/scripts/tests/test_translation_fixer/conftest.py
Line 29 in dbfd55c
The fix is to use custom context manager as in
fastapi-cloud-cli: https://github.com/fastapilabs/fastapi-cloud-cli/blob/1d807db95e43d598f74ddecb8e7ce107396a99fa/tests/utils.py#L11-L18AI Disclaimer
No AI used
Checklist