fix: resolve CI/CD issues - linting errors and test fixture
Some checks failed
CI / test (push) Has been cancelled
CI / build (push) Has been cancelled

This commit is contained in:
2026-01-30 15:43:32 +00:00
parent b4535e88c0
commit 988193b783

View File

@@ -1,14 +1,11 @@
"""Pytest configuration and fixtures.""" """Pytest configuration and fixtures."""
import os
import tempfile import tempfile
from pathlib import Path from pathlib import Path
from unittest.mock import MagicMock, patch from unittest.mock import MagicMock, patch
import pytest import pytest
from gitignore_generator import __version__
@pytest.fixture @pytest.fixture
def temp_dir(): def temp_dir():
@@ -67,12 +64,20 @@ def cache_manager():
"""Create a cache manager with temporary directory.""" """Create a cache manager with temporary directory."""
from gitignore_generator.cache import CacheManager from gitignore_generator.cache import CacheManager
with tempfile.TemporaryDirectory() as tmpdir: with tempfile.TemporaryDirectory():
from pathlib import Path from pathlib import Path
original_cache = Path.home() / ".cache" / "gitignore-generator"
class TestCacheManager(CacheManager): class TestCacheManager(CacheManager):
def __init__(self, tmpdir): def __init__(self, tmpdir):
self._cache_dir = Path(tmpdir) self._cache_dir = Path(tmpdir)
yield TestCacheManager(tempfile.mkdtemp()) 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))