Skip to content

Commit

Permalink
Fix test that passes on main anyway
Browse files Browse the repository at this point in the history
Black searches parent directories if the common base of the given
sources doesn't contain a "project root marker" so simply setting
--stdin-filename to `../whatever.py` won't cause any problems. Instead
let's set --stdin-filename to `../src/a.py` as `src` has its own
pyproject.toml file. Currently on main, the detected root will be the
parent directory of `src` but with this PR it'll be `src` as expected.
  • Loading branch information
ichard26 committed Aug 26, 2022
1 parent 6453abf commit 5a8dcfe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/test_black.py
Original file line number Diff line number Diff line change
Expand Up @@ -1398,8 +1398,8 @@ def test_find_project_root(self) -> None:

with change_directory(test_dir):
self.assertEqual(
black.find_project_root(("-",), stdin_filename="../whatever.py"),
(root.resolve(), "pyproject.toml"),
black.find_project_root(("-",), stdin_filename="../src/a.py"),
(src_dir.resolve(), "pyproject.toml"),
)

@patch(
Expand Down

0 comments on commit 5a8dcfe

Please sign in to comment.