"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "client/commands/tests/rage_test.py" between
pyre-check-0.0.54.tar.gz and pyre-check-0.0.55.tar.gz

About: Pyre is a performant type checker for Python (ships with Pysa, a security focused static analysis tool).

rage_test.py  (pyre-check-0.0.54):rage_test.py  (pyre-check-0.0.55)
skipping to change at line 44 skipping to change at line 44
original_directory=original_directory, original_directory=original_directory,
configuration=configuration, configuration=configuration,
analysis_directory=analysis_directory, analysis_directory=analysis_directory,
output_path=None, output_path=None,
)._flags(), )._flags(),
["-log-directory", ".pyre"], ["-log-directory", ".pyre"],
) )
def assert_output(self, output: io.StringIO) -> None: def assert_output(self, output: io.StringIO) -> None:
lines = output.getvalue().split("\n") lines = output.getvalue().split("\n")
self.assertEqual(len(lines), 4)
self.assertTrue(lines[0].startswith("Client version:")) self.assertTrue(lines[0].startswith("Client version:"))
self.assertTrue(lines[1].startswith("Binary path:")) self.assertTrue(lines[1].startswith("Binary path:"))
self.assertTrue(lines[2].startswith("Configured binary version:")) self.assertTrue(lines[2].startswith("Configured binary version:"))
self.assertEqual(lines[3], "<SERVER RAGE>") self.assertEqual(lines[3], "<SERVER RAGE>")
# pyre-fixme[56]: Pyre was not able to infer the type of argument `[]` to de
corator
# factory `unittest.mock.patch.object`.
@patch.object(recently_used_configurations.Cache, "get_all_items", return_va
lue=[])
@patch("sys.stdout", new_callable=io.StringIO) @patch("sys.stdout", new_callable=io.StringIO)
@patch("subprocess.run") @patch("subprocess.run")
@patch.object( @patch.object(
commands.Command, "_call_client", side_effect=_call_client_side_effect commands.Command, "_call_client", side_effect=_call_client_side_effect
) )
def test_terminal_output( def test_terminal_output(
self, call_client: MagicMock, run: MagicMock, stdout: MagicMock self,
call_client: MagicMock,
run: MagicMock,
stdout: MagicMock,
get_recently_used_configurations: MagicMock,
) -> None: ) -> None:
arguments = mock_arguments(local_configuration="foo/bar") arguments = mock_arguments(local_configuration="foo/bar")
configuration = mock_configuration() configuration = mock_configuration()
original_directory = "/original/directory" original_directory = "/original/directory"
analysis_directory = AnalysisDirectory(".") analysis_directory = AnalysisDirectory(".")
Rage( Rage(
arguments, arguments,
original_directory=original_directory, original_directory=original_directory,
configuration=configuration, configuration=configuration,
analysis_directory=analysis_directory, analysis_directory=analysis_directory,
output_path=None, output_path=None,
).run() ).run()
call_client.assert_called_once_with( call_client.assert_called_once_with(
command=Rage.NAME, capture_output=False, stdout=sys.stdout command=Rage.NAME, capture_output=False, stdout=sys.stdout
) )
self.assert_output(stdout) self.assert_output(stdout)
@patch.object(recently_used_configurations.Cache, "get_all_items", return_va lue=[])
# pyre-fixme[56]: Argument `tools.pyre.client.filesystem` to decorator facto ry # pyre-fixme[56]: Argument `tools.pyre.client.filesystem` to decorator facto ry
# `unittest.mock.patch.object` could not be resolved in a global scope. # `unittest.mock.patch.object` could not be resolved in a global scope.
@patch.object(filesystem, "acquire_lock") @patch.object(filesystem, "acquire_lock")
@patch("subprocess.run") @patch("subprocess.run")
@patch.object( @patch.object(
commands.Command, "_call_client", side_effect=_call_client_side_effect commands.Command, "_call_client", side_effect=_call_client_side_effect
) )
def test_file_output( def test_file_output(
self, call_client: MagicMock, run: MagicMock, acquire_lock: MagicMock self,
call_client: MagicMock,
run: MagicMock,
acquire_lock: MagicMock,
get_recently_used_configurations: MagicMock,
) -> None: ) -> None:
arguments = mock_arguments(local_configuration="foo/bar") arguments = mock_arguments(local_configuration="foo/bar")
configuration = mock_configuration() configuration = mock_configuration()
original_directory = "/original/directory" original_directory = "/original/directory"
analysis_directory = AnalysisDirectory(".") analysis_directory = AnalysisDirectory(".")
# We cannot use StringIO directly because .getvalue() fails after the # We cannot use StringIO directly because .getvalue() fails after the
# file is closed # file is closed
output_content = io.StringIO() output_content = io.StringIO()
output_file = MagicMock() output_file = MagicMock()
 End of changes. 5 change blocks. 
3 lines changed or deleted 16 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)