mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 00:05:01 +00:00
test: mock webbrowser.open in test setup
This commit is contained in:
parent
bce586f510
commit
d81c421bfe
1 changed files with 3 additions and 0 deletions
|
@ -32,6 +32,8 @@ class TestMain(TestCase):
|
||||||
os.environ["HOME"] = self.homedir_obj.name
|
os.environ["HOME"] = self.homedir_obj.name
|
||||||
self.input_patcher = patch("builtins.input", return_value=None)
|
self.input_patcher = patch("builtins.input", return_value=None)
|
||||||
self.mock_input = self.input_patcher.start()
|
self.mock_input = self.input_patcher.start()
|
||||||
|
self.webbrowser_patcher = patch("webbrowser.open")
|
||||||
|
self.mock_webbrowser = self.webbrowser_patcher.start()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
os.chdir(self.original_cwd)
|
os.chdir(self.original_cwd)
|
||||||
|
@ -40,6 +42,7 @@ class TestMain(TestCase):
|
||||||
os.environ.clear()
|
os.environ.clear()
|
||||||
os.environ.update(self.original_env)
|
os.environ.update(self.original_env)
|
||||||
self.input_patcher.stop()
|
self.input_patcher.stop()
|
||||||
|
self.webbrowser_patcher.stop()
|
||||||
|
|
||||||
def test_main_with_empty_dir_no_files_on_command(self):
|
def test_main_with_empty_dir_no_files_on_command(self):
|
||||||
main(["--no-git", "--exit"], input=DummyInput(), output=DummyOutput())
|
main(["--no-git", "--exit"], input=DummyInput(), output=DummyOutput())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue