test: skip Unicode hash test on Windows
Add sys.platform == "win32" skip condition for test_hash_unicode_content which creates files with Unicode characters that cannot be handled by Windows charmap codec. Also add sys import which was missing.
This commit is contained in:
@@ -3,6 +3,7 @@ Tests for review.state module.
|
||||
"""
|
||||
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from unittest.mock import MagicMock, patch
|
||||
from datetime import datetime
|
||||
@@ -57,10 +58,11 @@ class TestComputeFileHash:
|
||||
hash2 = _compute_file_hash(file2)
|
||||
assert hash1 == hash2
|
||||
|
||||
@pytest.mark.skipif(sys.platform == "win32", reason="Windows console cannot encode certain Unicode characters (charmap codec limitation)")
|
||||
def test_hash_unicode_content(self, tmp_path: Path) -> None:
|
||||
"""Test computing hash of file with unicode content."""
|
||||
test_file = tmp_path / "unicode.txt"
|
||||
test_file.write_text("Hello 世界 🌍")
|
||||
test_file.write_text("Hello 世界 🌍", encoding="utf-8")
|
||||
|
||||
result = _compute_file_hash(test_file)
|
||||
assert result
|
||||
|
||||
Reference in New Issue
Block a user