Skip to content

Commit

Permalink
Fix merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Shivansh-007 committed Mar 11, 2022
1 parent f4d6a50 commit d9776b8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 29 deletions.
28 changes: 1 addition & 27 deletions tests/test_black.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def invokeBlack(
) -> None:
runner = BlackRunner()
if ignore_config:
args = ["--verbose", "--config", str(THIS_DIR / "empty.toml"), *args]
args = ["--verbose", "--config", str(TOML_CONFIG_DIR / "empty.toml"), *args]
result = runner.invoke(black.main, args, catch_exceptions=False)
assert result.stdout_bytes is not None
assert result.stderr_bytes is not None
Expand Down Expand Up @@ -2042,7 +2042,6 @@ def test_symlink_out_of_root_directory(self) -> None:
path.iterdir.return_value = [child]
child.resolve.return_value = Path("/a/b/c")
child.as_posix.return_value = "/a/b/c"
child.is_symlink.return_value = True
try:
list(
black.gen_python_files(
Expand All @@ -2062,31 +2061,6 @@ def test_symlink_out_of_root_directory(self) -> None:
pytest.fail(f"`get_python_files_in_dir()` failed: {ve}")
path.iterdir.assert_called_once()
child.resolve.assert_called_once()
child.is_symlink.assert_called_once()
# `child` should behave like a strange file which resolved path is clearly
# outside of the `root` directory.
child.is_symlink.return_value = False
with pytest.raises(ValueError):
list(
black.gen_python_files(
path.iterdir(),
root,
include,
exclude,
None,
None,
report,
gitignore,
verbose=False,
quiet=False,
)
)
path.iterdir.assert_called()
assert path.iterdir.call_count == 2
child.resolve.assert_called()
assert child.resolve.call_count == 2
child.is_symlink.assert_called()
assert child.is_symlink.call_count == 2

@patch("black.find_project_root", lambda *args: (THIS_DIR.resolve(), None))
def test_get_sources_with_stdin(self) -> None:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
import pytest
from black import Mode
from _pytest.monkeypatch import MonkeyPatch
from tests.util import DATA_DIR
from tests.util import DATA_DIR, TOML_CONFIG_DIR

pytestmark = pytest.mark.jupyter
pytest.importorskip("IPython", reason="IPython is an optional dependency")
pytest.importorskip("tokenize_rt", reason="tokenize-rt is an optional dependency")

JUPYTER_MODE = Mode(is_ipynb=True)

EMPTY_CONFIG = DATA_DIR / "empty_pyproject.toml"
EMPTY_CONFIG = TOML_CONFIG_DIR / "empty_pyproject.toml"

runner = CliRunner()

Expand Down

0 comments on commit d9776b8

Please sign in to comment.