feat: Add YAML import check and skip tests if not available

This commit is contained in:
hlohaus
2026-03-21 21:46:32 +01:00
parent b6a6db2c2e
commit 7448194cac
4 changed files with 14 additions and 6 deletions
+3
View File
@@ -22,6 +22,7 @@ from g4f.providers.config_provider import (
RouterConfig,
ConfigModelProvider,
evaluate_condition,
has_yaml
)
@@ -271,6 +272,8 @@ class TestEvaluateCondition(unittest.TestCase):
class TestRouterConfig(unittest.TestCase):
def setUp(self):
if not has_yaml:
self.skipTest('"yaml" not installed')
RouterConfig.clear()
def test_load_valid_yaml(self):
+2 -1
View File
@@ -18,4 +18,5 @@ markitdown[all]
a2wsgi
python-dotenv
ddgs
cloudscraper
cloudscraper
yaml
+2 -1
View File
@@ -20,4 +20,5 @@ python-dotenv
ddgs
cloudscraper
wasmtime
numpy
numpy
yaml
+7 -4
View File
@@ -41,7 +41,8 @@ EXTRA_REQUIRE = {
"aiofile",
"cloudscraper",
"wasmtime",
"numpy"
"numpy",
"yaml",
],
'slim': [
"curl_cffi>=0.6.2",
@@ -62,12 +63,13 @@ EXTRA_REQUIRE = {
"python-docx",
"python-dotenv",
"aiofile",
"cloudscraper"
"cloudscraper",
"yaml",
],
"image": [
"pillow",
"cairosvg",
"beautifulsoup4"
"beautifulsoup4",
],
"webview": [
"pywebview",
@@ -80,6 +82,7 @@ EXTRA_REQUIRE = {
"uvicorn",
"python-multipart",
"a2wsgi",
"yaml"
],
"gui": [
"werkzeug", "flask[async]",
@@ -95,7 +98,7 @@ EXTRA_REQUIRE = {
],
"files": [
"beautifulsoup4",
"markitdown[all]"
"markitdown[all]",
]
}