1212from pathlib import Path
1313from unittest .mock import call , mock_open , patch
1414
15- from ... import commands
1615from ...commands import initialize
1716from ...commands .initialize import log
1817
@@ -55,9 +54,7 @@ def exists(path):
5554 isfile .side_effect = exists
5655 # One for shutil.which("watchman"), another for shutil.which(BINARY_NAME).
5756 which .side_effect = ["watchman" , "binary" ]
58- with patch .object (commands .Command , "_call_client" ), patch .object (
59- initialize , "find_typeshed" , return_value = Path ("/tmp" )
60- ):
57+ with patch .object (initialize , "find_typeshed" , return_value = Path ("/tmp" )):
6158 initialize .Initialize ().run ()
6259 subprocess_run .assert_has_calls (
6360 [
@@ -78,18 +75,14 @@ def exists(path):
7875 isfile .side_effect = exists
7976 file = mock_open ()
8077 with patch ("builtins.open" , file ), patch .object (
81- commands .Command , "_call_client"
82- ), patch .object (
8378 initialize .Initialize , "_get_local_configuration" , return_value = {}
84- ), patch .object (
85- initialize .Initialize , "_is_local" , return_value = True
86- ):
79+ ), patch .object (initialize .Initialize , "_is_local" , return_value = True ):
8780 initialize .Initialize ().run ()
8881 file ().write .assert_has_calls ([call ("{}" ), call ("\n " )])
8982
90- with patch .object (commands . Command , "_call_client" ), patch .object (
91- sys , "argv " , [ "/tmp/pyre/bin/pyre" ]
92- ), patch . object ( initialize , "find_typeshed" , return_value = Path ( "/tmp" )) :
83+ with patch .object (sys , "argv" , [ "/tmp/pyre/bin/pyre" ] ), patch .object (
84+ initialize , "find_typeshed " , return_value = Path ( "/tmp" )
85+ ):
9386 which .reset_mock ()
9487 which .side_effect = [True , None , "/tmp/pyre/bin/pyre.bin" ]
9588 initialize .Initialize ()._get_configuration ()
0 commit comments