def test_run_existing_file_argument(self):
streamlit run succeeds if an existing file is passed
// Mocking _main_run
cli._main_run = MagicMock()
with patch("validators.url", return_value=False):
with patch("os.path.exists", return_value=True):
result = self.runner.invoke(cli, ["run", "file_name"])
After Change
def test_run_existing_file_argument(self):
streamlit run succeeds if an existing file is passed
with patch("validators.url", return_value=False), patch(
"streamlit.cli._main_run"
), patch("os.path.exists", return_value=True):
result = self.runner.invoke(cli, ["run", "file_name"])
self.assertEqual(0, result.exit_code)