mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2025-12-31 20:36:24 +00:00
Enhance logging cleanup: Introduce global handler management for proper resource cleanup on exit and during logging setup. Update tests to ensure file handlers are closed correctly across platforms.
This commit is contained in:
@ -6,6 +6,8 @@ import os
|
||||
from pathlib import Path
|
||||
import tempfile
|
||||
|
||||
import pytest
|
||||
|
||||
from libp2p.utils.paths import (
|
||||
create_temp_file,
|
||||
ensure_dir_exists,
|
||||
@ -217,6 +219,12 @@ class TestCrossPlatformCompatibility:
|
||||
|
||||
def test_config_dir_platform_specific_windows(self, monkeypatch):
|
||||
"""Test config directory respects Windows conventions."""
|
||||
import platform
|
||||
|
||||
# Only run this test on Windows systems
|
||||
if platform.system() != "Windows":
|
||||
pytest.skip("This test only runs on Windows systems")
|
||||
|
||||
monkeypatch.setattr("os.name", "nt")
|
||||
monkeypatch.setenv("APPDATA", "C:\\Users\\Test\\AppData\\Roaming")
|
||||
config_dir = get_config_dir()
|
||||
|
||||
Reference in New Issue
Block a user