| 5 | |
| 6 | |
| 7 | def test_browser(caplog): |
| 8 | caplog.set_level("INFO") |
| 9 | with ( |
| 10 | mock.patch("subprocess.Popen") as po, |
| 11 | mock.patch("shutil.which") as which, |
| 12 | taddons.context(), |
| 13 | ): |
| 14 | which.return_value = "chrome" |
| 15 | b = browser.Browser() |
| 16 | b.start() |
| 17 | assert po.called |
| 18 | |
| 19 | b.start() |
| 20 | assert "Starting additional browser" in caplog.text |
| 21 | assert len(b.browser) == 2 |
| 22 | |
| 23 | b.start("unsupported-browser") |
| 24 | assert "Invalid browser name." in caplog.text |
| 25 | assert len(b.browser) == 2 |
| 26 | b.done() |
| 27 | assert not b.browser |
| 28 | |
| 29 | |
| 30 | async def test_no_browser(caplog): |