def test_camera_procs(self): baseline = get_power() prev = baseline used = {} for proc in PROCS: managed_processes[proc.name].start() time.sleep(proc.warmup) now = get_power(8) used[proc.name] = now - prev prev = now manager_cleanup() print("-" * 35) print(f"Baseline {baseline:.2f}W\n") for proc in PROCS: cur = used[proc.name] expected = proc.power print(f"{proc.name.ljust(20)} {expected:.2f}W {cur:.2f}W") with self.subTest(proc=proc.name): self.assertTrue( math.isclose(cur, expected, rel_tol=proc.rtol, abs_tol=proc.atol)) print("-" * 35)
def tearDown(self): manager.manager_cleanup()