"""Test fixture cleanup behavior."""

import os
from pathlib import Path


def test_tmp_config_file_cleanup_verification(tmp_config_file):
    """Verify temporary config file cleanup."""
    # Store paths before cleanup
    config_path = tmp_config_file
    backup_path = config_path.with_suffix(".config.bak")

    # Files should exist during test
    assert config_path.exists()

    # Create backup to test cleanup
    backup_path.write_text("backup")
    assert backup_path.exists()

    # Store paths as strings for later verification
    config_str = str(config_path)
    backup_str = str(backup_path)

    # Both should exist now
    assert Path(config_str).exists()
    assert Path(backup_str).exists()


def test_tmp_config_dir_cleanup_verification(tmp_config_dir):
    """Verify temporary directory cleanup."""
    # Directory should exist during test
    assert tmp_config_dir.exists()
    assert tmp_config_dir.is_dir()

    # Create some files in it
    test_file = tmp_config_dir / "test.txt"
    test_file.write_text("test content")
    assert test_file.exists()

    # Directory should be writable
    (tmp_config_dir / "another.txt").write_text("more content")
    assert (tmp_config_dir / "another.txt").exists()
