feat: tighten ai concurrency settings
This commit is contained in:
@@ -62,6 +62,45 @@ class AppConfigTests(TempDirMixin, unittest.TestCase):
|
||||
|
||||
self.assert_removed(temp_dir)
|
||||
|
||||
def test_ai_concurrency_and_retry_are_clamped(self):
|
||||
with self.make_temp_dir() as temp_dir:
|
||||
config_path = os.path.join(temp_dir, "config.json")
|
||||
|
||||
with open(config_path, "w", encoding="utf-8") as fh:
|
||||
json.dump(
|
||||
{
|
||||
"ai": {
|
||||
"title_concurrency": 0,
|
||||
"image_concurrency": 64,
|
||||
"retry": 20,
|
||||
}
|
||||
},
|
||||
fh,
|
||||
)
|
||||
|
||||
loaded = appconfig.load_config(config_path)
|
||||
ai = appconfig.ai_config(loaded)
|
||||
self.assertEqual(1, ai["title_concurrency"])
|
||||
self.assertEqual(5, ai["image_concurrency"])
|
||||
self.assertEqual(10, ai["retry"])
|
||||
|
||||
saved = appconfig.save_config(
|
||||
{
|
||||
"ai": {
|
||||
"title_concurrency": 3,
|
||||
"image_concurrency": 4,
|
||||
"retry": 2,
|
||||
}
|
||||
},
|
||||
path=config_path,
|
||||
)
|
||||
ai = appconfig.ai_config(saved)
|
||||
self.assertEqual(3, ai["title_concurrency"])
|
||||
self.assertEqual(4, ai["image_concurrency"])
|
||||
self.assertEqual(2, ai["retry"])
|
||||
|
||||
self.assert_removed(temp_dir)
|
||||
|
||||
def test_data_paths_resolve_under_default_data_dir(self):
|
||||
with self.make_temp_dir() as temp_dir:
|
||||
data_root = os.path.join(temp_dir, "data")
|
||||
|
||||
@@ -788,6 +788,13 @@ class GuiTests(TempDirMixin, unittest.TestCase):
|
||||
)
|
||||
self.addCleanup(tab.close)
|
||||
|
||||
self.assertEqual(1, tab.title_concurrency_spin.minimum())
|
||||
self.assertEqual(5, tab.title_concurrency_spin.maximum())
|
||||
self.assertEqual(1, tab.image_concurrency_spin.minimum())
|
||||
self.assertEqual(5, tab.image_concurrency_spin.maximum())
|
||||
self.assertEqual(0, tab.retry_spin.minimum())
|
||||
self.assertEqual(10, tab.retry_spin.maximum())
|
||||
|
||||
text_roles = [
|
||||
tab.default_text_model_combo.itemData(index)
|
||||
for index in range(tab.default_text_model_combo.count())
|
||||
|
||||
Reference in New Issue
Block a user