Skip to content

Commit

Permalink
Remove all _call_client mock in init tests
Browse files Browse the repository at this point in the history
Reviewed By: shannonzhu

Differential Revision: D23762991

fbshipit-source-id: 55f12882ebb9ff31c0976d59da1540026c6d812f
  • Loading branch information
grievejia authored and facebook-github-bot committed Sep 18, 2020
1 parent b0a0af0 commit 48d5486
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions client/commands/tests/initialize_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from pathlib import Path
from unittest.mock import call, mock_open, patch

from ... import commands
from ...commands import initialize
from ...commands.initialize import log

Expand Down Expand Up @@ -55,9 +54,7 @@ def exists(path):
isfile.side_effect = exists
# One for shutil.which("watchman"), another for shutil.which(BINARY_NAME).
which.side_effect = ["watchman", "binary"]
with patch.object(commands.Command, "_call_client"), patch.object(
initialize, "find_typeshed", return_value=Path("/tmp")
):
with patch.object(initialize, "find_typeshed", return_value=Path("/tmp")):
initialize.Initialize().run()
subprocess_run.assert_has_calls(
[
Expand All @@ -78,18 +75,14 @@ def exists(path):
isfile.side_effect = exists
file = mock_open()
with patch("builtins.open", file), patch.object(
commands.Command, "_call_client"
), patch.object(
initialize.Initialize, "_get_local_configuration", return_value={}
), patch.object(
initialize.Initialize, "_is_local", return_value=True
):
), patch.object(initialize.Initialize, "_is_local", return_value=True):
initialize.Initialize().run()
file().write.assert_has_calls([call("{}"), call("\n")])

with patch.object(commands.Command, "_call_client"), patch.object(
sys, "argv", ["/tmp/pyre/bin/pyre"]
), patch.object(initialize, "find_typeshed", return_value=Path("/tmp")):
with patch.object(sys, "argv", ["/tmp/pyre/bin/pyre"]), patch.object(
initialize, "find_typeshed", return_value=Path("/tmp")
):
which.reset_mock()
which.side_effect = [True, None, "/tmp/pyre/bin/pyre.bin"]
initialize.Initialize()._get_configuration()
Expand Down

0 comments on commit 48d5486

Please sign in to comment.