From 96b1e1d04feac9cab53a97c136656b142c95e34f Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Tue, 16 Jul 2024 11:27:27 +0100 Subject: [PATCH] finished scrape tests --- pytest.ini | 1 + tests/scrape/test_scrape.py | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pytest.ini b/pytest.ini index 0fb394382..ab9d6d15d 100644 --- a/pytest.ini +++ b/pytest.ini @@ -5,5 +5,6 @@ testpaths = tests/basic tests/help tests/browser + tests/scrape diff --git a/tests/scrape/test_scrape.py b/tests/scrape/test_scrape.py index 6b04413d9..3b02c70fc 100644 --- a/tests/scrape/test_scrape.py +++ b/tests/scrape/test_scrape.py @@ -1,5 +1,5 @@ import unittest -from unittest.mock import patch, MagicMock +from unittest.mock import patch from aider.commands import Commands from aider.io import InputOutput @@ -7,10 +7,10 @@ from aider.io import InputOutput class TestScrape(unittest.TestCase): def setUp(self): - self.io = InputOutput() + self.io = InputOutput(yes=True) self.commands = Commands(self.io, None) - @patch('aider.scraper.Scraper.scrape') + @patch("aider.scrape.Scraper.scrape") def test_cmd_web_imports_playwright(self, mock_scrape): # Mock the scrape method mock_scrape.return_value = "Mocked webpage content" @@ -26,15 +26,15 @@ class TestScrape(unittest.TestCase): # Try to import playwright try: - import playwright + import playwright # noqa: F401 + playwright_imported = True except ImportError: playwright_imported = False # Assert that playwright was successfully imported self.assertTrue( - playwright_imported, - "Playwright should be importable after running cmd_web" + playwright_imported, "Playwright should be importable after running cmd_web" )