mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 23:47:41 +08:00
fix: change logging level to debug for plugin restoration and add tests for warning filters
This commit is contained in:
+2
-2
@@ -135,12 +135,12 @@ class SystemChain(ChainBase):
|
|||||||
if target_path.exists():
|
if target_path.exists():
|
||||||
shutil.rmtree(target_path)
|
shutil.rmtree(target_path)
|
||||||
shutil.copytree(item, target_path)
|
shutil.copytree(item, target_path)
|
||||||
logger.info(f"已恢复插件目录: {item.name}")
|
logger.debug(f"已恢复插件目录: {item.name}")
|
||||||
restored_count += 1
|
restored_count += 1
|
||||||
# 如果是文件
|
# 如果是文件
|
||||||
elif item.is_file():
|
elif item.is_file():
|
||||||
shutil.copy2(item, target_path)
|
shutil.copy2(item, target_path)
|
||||||
logger.info(f"已恢复插件文件: {item.name}")
|
logger.debug(f"已恢复插件文件: {item.name}")
|
||||||
restored_count += 1
|
restored_count += 1
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"恢复插件 {item.name} 时发生错误: {str(e)}")
|
logger.error(f"恢复插件 {item.name} 时发生错误: {str(e)}")
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import warnings
|
||||||
|
|
||||||
|
import app
|
||||||
|
|
||||||
|
|
||||||
|
def test_app_installs_known_oss2_invalid_escape_warning_filter():
|
||||||
|
"""
|
||||||
|
app 初始化过滤器应覆盖 oss2 在 Python 3.12 下产生的无害转义警告。
|
||||||
|
"""
|
||||||
|
app._filter_third_party_startup_warnings()
|
||||||
|
action, message, category, module, lineno = warnings.filters[0]
|
||||||
|
|
||||||
|
assert action == "ignore"
|
||||||
|
assert message.match("invalid escape sequence '\\&'")
|
||||||
|
assert category is SyntaxWarning
|
||||||
|
assert module is None
|
||||||
|
assert lineno == 0
|
||||||
Reference in New Issue
Block a user