mirror of
https://github.com/open-jarvis/OpenJarvis.git
synced 2026-07-30 10:52:15 +00:00
fix: resolve CI failures — lint, import guards, and test fixtures
- Remove unused imports (os, pytest) in test_rust_bridge.py - Add pytest.importorskip for fastapi/starlette in test_learning_api.py - Fix AppleEnergyMonitor test fixtures: set _zeus_ok, _chip_name, _tdp_watts attributes when using __new__ to skip __init__ - Fix uninitialized monitor test to match CPU-time fallback behavior Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
c488e2a263
commit
6bb323a9fc
@@ -65,6 +65,7 @@ class TestEnergyMethod:
|
||||
from openjarvis.telemetry.energy_apple import AppleEnergyMonitor
|
||||
|
||||
monitor = AppleEnergyMonitor.__new__(AppleEnergyMonitor)
|
||||
monitor._zeus_ok = True
|
||||
assert monitor.energy_method() == "zeus"
|
||||
|
||||
|
||||
@@ -91,7 +92,8 @@ class TestSampleComponentBreakdown:
|
||||
monitor = AppleEnergyMonitor.__new__(AppleEnergyMonitor)
|
||||
monitor._poll_interval_ms = 50
|
||||
monitor._monitor = mock_zeus_monitor
|
||||
monitor._initialized = True
|
||||
monitor._zeus_ok = True
|
||||
monitor._chip_name = "M1"
|
||||
|
||||
with monitor.sample() as result:
|
||||
time.sleep(0.01)
|
||||
@@ -123,7 +125,8 @@ class TestSampleComponentBreakdown:
|
||||
monitor = AppleEnergyMonitor.__new__(AppleEnergyMonitor)
|
||||
monitor._poll_interval_ms = 50
|
||||
monitor._monitor = mock_zeus_monitor
|
||||
monitor._initialized = True
|
||||
monitor._zeus_ok = True
|
||||
monitor._chip_name = "M1"
|
||||
|
||||
with monitor.sample() as result:
|
||||
pass
|
||||
@@ -145,15 +148,19 @@ class TestSampleUninitialized:
|
||||
monitor = AppleEnergyMonitor.__new__(AppleEnergyMonitor)
|
||||
monitor._poll_interval_ms = 50
|
||||
monitor._monitor = None
|
||||
monitor._initialized = False
|
||||
monitor._zeus_ok = False
|
||||
monitor._chip_name = "Apple Silicon"
|
||||
monitor._tdp_watts = 20.0
|
||||
|
||||
with monitor.sample() as result:
|
||||
pass
|
||||
|
||||
assert result.energy_joules == 0.0
|
||||
assert result.cpu_energy_joules == 0.0
|
||||
assert result.gpu_energy_joules == 0.0
|
||||
assert result.dram_energy_joules == 0.0
|
||||
assert result.ane_energy_joules == 0.0
|
||||
# CPU-time fallback produces small but non-zero estimates
|
||||
assert result.energy_joules >= 0.0
|
||||
assert result.cpu_energy_joules >= 0.0
|
||||
assert result.gpu_energy_joules >= 0.0
|
||||
assert result.dram_energy_joules >= 0.0
|
||||
assert result.ane_energy_joules >= 0.0
|
||||
assert result.duration_seconds >= 0
|
||||
assert result.vendor == "apple"
|
||||
assert result.energy_method == "cpu_time_estimate"
|
||||
|
||||
Reference in New Issue
Block a user