summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-03-12 02:15:22 +0100
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-03-12 02:15:22 +0100
commit2a3880ac2f51f2a02ba64fe6bb2547e221580e93 (patch)
tree5d87fd63dc80ef191d947fa79c95b818cd560f28
parentRemove all not working provider (#1679) (diff)
downloadgpt4free-2a3880ac2f51f2a02ba64fe6bb2547e221580e93.tar
gpt4free-2a3880ac2f51f2a02ba64fe6bb2547e221580e93.tar.gz
gpt4free-2a3880ac2f51f2a02ba64fe6bb2547e221580e93.tar.bz2
gpt4free-2a3880ac2f51f2a02ba64fe6bb2547e221580e93.tar.lz
gpt4free-2a3880ac2f51f2a02ba64fe6bb2547e221580e93.tar.xz
gpt4free-2a3880ac2f51f2a02ba64fe6bb2547e221580e93.tar.zst
gpt4free-2a3880ac2f51f2a02ba64fe6bb2547e221580e93.zip
Diffstat (limited to '')
-rw-r--r--etc/unittest/backend.py7
-rw-r--r--g4f/webdriver.py2
2 files changed, 6 insertions, 3 deletions
diff --git a/etc/unittest/backend.py b/etc/unittest/backend.py
index c4ab219e..ee6174d5 100644
--- a/etc/unittest/backend.py
+++ b/etc/unittest/backend.py
@@ -3,6 +3,7 @@ import asyncio
from unittest.mock import MagicMock
from .mocks import ProviderMock
import g4f
+from g4f.errors import MissingRequirementsError
try:
from g4f.gui.server.backend import Backend_Api, get_error_message
@@ -34,9 +35,11 @@ class TestBackendApi(unittest.TestCase):
self.assertTrue(len(response) > 0)
def test_search(self):
- # Task was destroyed but it is pending!
from g4f.gui.server.internet import search
- result = asyncio.run(search("Hello"))
+ try:
+ result = asyncio.run(search("Hello"))
+ except MissingRequirementsError:
+ self.skipTest("search is not installed")
self.assertEqual(5, len(result))
class TestUtilityFunctions(unittest.TestCase):
diff --git a/g4f/webdriver.py b/g4f/webdriver.py
index 47962d96..21dbc469 100644
--- a/g4f/webdriver.py
+++ b/g4f/webdriver.py
@@ -10,6 +10,7 @@ try:
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import NoSuchElementException
+ from undetected_chromedriver import Chrome, ChromeOptions
has_requirements = True
except ImportError:
from typing import Type as WebDriver, Callable as user_config_dir
@@ -44,7 +45,6 @@ try:
super().__init__(*args, options=options, **kwargs)
has_seleniumwire = True
except:
- from undetected_chromedriver import Chrome, ChromeOptions
has_seleniumwire = False
def get_browser(