55from pathlib import Path
66from subprocess import CalledProcessError , run
77from sys import stderr
8+ from time import perf_counter
89from typing import Any
910
1011ROOT_DIR = Path (__file__ ).parent .parent
@@ -48,6 +49,7 @@ def __init__(
4849 args : list [str ] = ["latexmk" ],
4950 env : dict [str , str ] | None = None ,
5051 ) -> None :
52+ assert directory .exists ()
5153 self .icon = icon
5254 self .directory = directory
5355 self .name = name or directory .name
@@ -57,7 +59,7 @@ def __init__(
5759 def execute (self ) -> CalledProcessError | None :
5860 """Execute the test case."""
5961 print (f"🟡 Compiling `{ self } `" , file = stderr )
60- assert self . directory . exists ()
62+ start = perf_counter ()
6163 try :
6264 run (
6365 self .args ,
@@ -66,11 +68,13 @@ def execute(self) -> CalledProcessError | None:
6668 env = None if self .env is None else {** environ , ** self .env },
6769 check = True ,
6870 )
69- log (f"✅{ self .icon } 可正常编译 { self .name } 。" )
7071 except CalledProcessError as error :
7172 log (f"💥{ self .icon } 无法编译 { self .name } 。" )
7273 return error
7374
75+ duration = perf_counter () - start
76+ log (f"✅{ self .icon } 可正常编译 { self .name } :⌛ { duration :.1f} 秒。" )
77+
7478
7579TESTS = [
7680 TestCase ("📁" , SCAFFOLD_DIR / "undergraduate-thesis" ),
0 commit comments