-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix false symlink detection claims in verbose output (#3385)
When trying to format a project from the outside, the verbose output shows says that there are symbolic links that points outside of the project, but displays the wrong project path, meaning that these messages are false positives. This bug is triggered when the command is executed from outside a project on a folder inside it, causing an inconsistency between the path to the detected project root and the relative path to the target contents. The fix is to normalize the target path using the project root before processing the sources, which removes the presence of the incorrect messages. --- The test attemps to emulate the behavior of the CLI as closely as posible by patching some `pathlib.Path` methods and passing certain reference paths to the context object and `black.get_sources`. Before the associated fix was introduced, this test failed because some of the captured files reported the presence of a symlink due to an incorrectly formated path. The test also asserts that only a single file is reported as ignored, which is part of the expected behavior. Signed-off-by: Antonio Ossa Guerra <[email protected]>
- Loading branch information
Showing
3 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters