diff --git a/tests/conftest.py b/tests/conftest.py index a6f6f31..55a2664 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,14 +1,11 @@ """Pytest configuration and fixtures.""" -import os import tempfile from pathlib import Path from unittest.mock import MagicMock, patch import pytest -from gitignore_generator import __version__ - @pytest.fixture def temp_dir(): @@ -67,12 +64,20 @@ def cache_manager(): """Create a cache manager with temporary directory.""" from gitignore_generator.cache import CacheManager - with tempfile.TemporaryDirectory() as tmpdir: + with tempfile.TemporaryDirectory(): from pathlib import Path - original_cache = Path.home() / ".cache" / "gitignore-generator" class TestCacheManager(CacheManager): def __init__(self, tmpdir): self._cache_dir = Path(tmpdir) yield TestCacheManager(tempfile.mkdtemp()) + + +@pytest.fixture +def detector(): + """Create detector with temp directory.""" + from gitignore_generator.detector import ProjectDetector + + with tempfile.TemporaryDirectory() as tmpdir: + yield ProjectDetector(Path(tmpdir))