test: fix platform-specific test failures
- test_auth.py: Update regex to expect "Unsupported platform" instead of "Encrypted token decryption" since platform check happens before decryption - test_file_utils.py: Skip test_atomic_write_permission_denied_parent on Windows where chmod doesn't prevent file creation
This commit is contained in:
@@ -937,10 +937,11 @@ class TestTokenValidationEdgeCases:
|
||||
valid_token = "enc:0123456789"
|
||||
|
||||
# This should pass basic length validation
|
||||
# (will fail later during actual decryption attempt with NotImplementedError)
|
||||
# (will fail later during actual decryption attempt with ValueError)
|
||||
# Arrange & Act & Assert
|
||||
# Will fail during platform decryption, not validation
|
||||
with pytest.raises(ValueError, match="Encrypted token decryption"):
|
||||
# Will fail during platform check since is_macos is mocked to False
|
||||
# and platform is not Linux or Windows either
|
||||
with pytest.raises(ValueError, match="Unsupported platform"):
|
||||
decrypt_token(valid_token)
|
||||
|
||||
|
||||
|
||||
@@ -504,13 +504,19 @@ class TestAtomicWriteEdgeCases:
|
||||
|
||||
def test_atomic_write_permission_denied_parent(self, tmp_path):
|
||||
"""Test atomic_write when parent directory is read-only."""
|
||||
import sys
|
||||
import stat
|
||||
|
||||
# Skip on Windows - chmod doesn't prevent file creation
|
||||
if sys.platform == "win32":
|
||||
pytest.skip("Directory read-only doesn't prevent file creation on Windows")
|
||||
|
||||
# Create a directory and make it read-only
|
||||
ro_dir = tmp_path / "readonly"
|
||||
ro_dir.mkdir()
|
||||
filepath = ro_dir / "test.txt"
|
||||
|
||||
# Make directory read-only (skip on Windows where chmod may not work)
|
||||
import stat
|
||||
# Make directory read-only (skip on platforms where chmod may not work)
|
||||
try:
|
||||
ro_dir.chmod(stat.S_IRUSR | stat.S_IXUSR)
|
||||
except (OSError, AttributeError):
|
||||
|
||||
Reference in New Issue
Block a user