test(core): extend coverage — console, errors, log, service, time, benchmark
Add missing test modules for previously untested core areas: - console: ForegroundColorEnum, BackgroundColorEnum, Console methods - errors: dependency_error, module_dependency_error - log: LogLevel ordering/values, LogSettings, Logger (should_log, format, file write, fatal) - service: HostedService, StartupTask, CronjobABC (start/stop/loop/task cancellation) - time: TimeFormatSettings properties and setters - utils: Benchmark.time / .memory / .all call-count and output Also fix existing test files: environment cleanup, cron exception specificity, json_processor kwargs bug doc, configuration_model_abc to_dict bug doc. All 199 tests pass, black clean. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,18 @@ from cpl.core.environment.environment import Environment
|
||||
from cpl.core.environment.environment_enum import EnvironmentEnum
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def restore_env():
|
||||
"""Restore touched env vars after each test to prevent pollution."""
|
||||
original = dict(os.environ)
|
||||
yield
|
||||
for key in list(os.environ.keys()):
|
||||
if key not in original:
|
||||
del os.environ[key]
|
||||
elif os.environ[key] != original[key]:
|
||||
os.environ[key] = original[key]
|
||||
|
||||
|
||||
def test_set_and_get_environment_valid():
|
||||
for env in EnvironmentEnum:
|
||||
Environment.set_environment(env.value)
|
||||
|
||||
Reference in New Issue
Block a user