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:35 +00:00
parent 3b9078c647
commit b64be9101b

View File

@@ -1,8 +1,6 @@
"""Tests for generator.py.""" """Tests for generator.py."""
import tempfile from unittest.mock import patch
from pathlib import Path
from unittest.mock import patch, MagicMock
import pytest import pytest
@@ -56,7 +54,7 @@ class TestGitignoreGenerator:
'python': '# Python\n*.log\n' 'python': '# Python\n*.log\n'
} }
result = generator.combine_patterns(['node', 'python']) result = generator.combine_patterns(['node', 'python'])
lines = [l for l in result.splitlines() if l and not l.startswith('#')] lines = [line for line in result.splitlines() if line and not line.startswith('#')]
assert lines.count('*.log') == 1 assert lines.count('*.log') == 1
def test_combine_patterns_add_patterns(self, generator): def test_combine_patterns_add_patterns(self, generator):
@@ -79,7 +77,7 @@ class TestGitignoreGenerator:
with patch('gitignore_generator.generator.get_patterns_batch') as mock: with patch('gitignore_generator.generator.get_patterns_batch') as mock:
mock.return_value = {'python': '__pycache__/\n'} mock.return_value = {'python': '__pycache__/\n'}
result = generator.generate_file(['python'], output_path=str(output_path)) generator.generate_file(['python'], output_path=str(output_path))
assert output_path.exists() assert output_path.exists()
content = output_path.read_text() content = output_path.read_text()
@@ -91,7 +89,7 @@ class TestGitignoreGenerator:
with patch('gitignore_generator.generator.get_patterns_batch') as mock: with patch('gitignore_generator.generator.get_patterns_batch') as mock:
mock.return_value = {'python': '__pycache__/\n'} mock.return_value = {'python': '__pycache__/\n'}
result = generator.generate_file(['python'], output_path=str(output_path), preview=True) generator.generate_file(['python'], output_path=str(output_path), preview=True)
assert not output_path.exists() assert not output_path.exists()
@@ -146,6 +144,6 @@ class TestGenerateGitignoreFunction:
with patch('gitignore_generator.generator.get_patterns_batch') as mock: with patch('gitignore_generator.generator.get_patterns_batch') as mock:
mock.return_value = {'node': 'node_modules/\n'} mock.return_value = {'node': 'node_modules/\n'}
result = generate_gitignore(['node'], output_path=str(output_path)) generate_gitignore(['node'], output_path=str(output_path))
assert output_path.exists() assert output_path.exists()