import time
import os


def create_test_document(base_path, filename, content):
    """Create a test document with specified content"""
    file_path = os.path.join(base_path, filename)
    # Create directory if it doesn't exist (for subdirectories)
    os.makedirs(os.path.dirname(file_path), exist_ok=True)
    with open(file_path, "w") as f:
        f.write(content)
    return file_path


def modify_test_document(file_path, new_content):
    """Modify an existing test document"""
    with open(file_path, "w") as f:
        f.write(new_content)
    # Ensure modification time changes
    time.sleep(0.1)


def delete_test_document(file_path):
    """Delete a test document"""
    if os.path.exists(file_path):
        os.remove(file_path)
