fix: resolve CI/CD issues - linting errors and test fixture
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
"""Tests for generator.py."""
|
||||
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch, MagicMock
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -56,7 +54,7 @@ class TestGitignoreGenerator:
|
||||
'python': '# Python\n*.log\n'
|
||||
}
|
||||
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
|
||||
|
||||
def test_combine_patterns_add_patterns(self, generator):
|
||||
@@ -79,7 +77,7 @@ class TestGitignoreGenerator:
|
||||
|
||||
with patch('gitignore_generator.generator.get_patterns_batch') as mock:
|
||||
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()
|
||||
content = output_path.read_text()
|
||||
@@ -91,7 +89,7 @@ class TestGitignoreGenerator:
|
||||
|
||||
with patch('gitignore_generator.generator.get_patterns_batch') as mock:
|
||||
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()
|
||||
|
||||
@@ -146,6 +144,6 @@ class TestGenerateGitignoreFunction:
|
||||
|
||||
with patch('gitignore_generator.generator.get_patterns_batch') as mock:
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user