MCPcopy Create free account
hub / github.com/ZhaJiMan/frykit / TestExample

Class TestExample

tests/test_example.py:10–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8
9
10class TestExample(TestCase):
11 def setUp(self) -> None:
12 new_dir("image")
13
14 def test_run(self) -> None:
15 """运行所有示例脚本
16
17 脚本在 example 目录,通过切换工作目录让图片输出到 image 目录。
18 注意 import_module 只会按 sys.path 的内容去查找模块,不受切换工作目录的影响。
19 """
20 names = [filepath.stem for filepath in Path("example").glob("*.py")]
21 with chdir_context("image"):
22 for name in names:
23 if name not in {"clabel", "river", "nerv_style"}:
24 try:
25 import_module(f"example.{name}")
26 logger.info(name)
27 except Exception:
28 logger.exception(name)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected