mirror of https://github.com/borgbackup/borg.git
Merge pull request #7262 from ThomasWaldmann/skip-safe-unlink-test-windows
support win32 for test_safe_unlink* tests
This commit is contained in:
commit
ca1f1281d5
|
@ -31,4 +31,4 @@ jobs:
|
|||
run: |
|
||||
./dist/borg.exe -V
|
||||
pip install -e .
|
||||
pytest --benchmark-skip -k "not remote"
|
||||
pytest --benchmark-skip -vv -rs -k "not remote"
|
||||
|
|
|
@ -45,7 +45,7 @@ from ..helpers import safe_unlink
|
|||
from ..helpers.passphrase import Passphrase, PasswordRetriesExceeded
|
||||
from ..platform import is_cygwin
|
||||
|
||||
from . import BaseTestCase, FakeInputs
|
||||
from . import BaseTestCase, FakeInputs, are_hardlinks_supported
|
||||
|
||||
|
||||
def test_bin_to_hex():
|
||||
|
@ -1100,24 +1100,26 @@ def test_eval_escapes():
|
|||
assert eval_escapes("äç\\n") == "äç\n"
|
||||
|
||||
|
||||
@pytest.mark.skipif(not are_hardlinks_supported(), reason="hardlinks not supported")
|
||||
def test_safe_unlink_is_safe(tmpdir):
|
||||
contents = b"Hello, world\n"
|
||||
victim = tmpdir / "victim"
|
||||
victim.write_binary(contents)
|
||||
hard_link = tmpdir / "hardlink"
|
||||
hard_link.mklinkto(victim)
|
||||
os.link(str(victim), str(hard_link)) # hard_link.mklinkto is not implemented on win32
|
||||
|
||||
safe_unlink(hard_link)
|
||||
|
||||
assert victim.read_binary() == contents
|
||||
|
||||
|
||||
@pytest.mark.skipif(not are_hardlinks_supported(), reason="hardlinks not supported")
|
||||
def test_safe_unlink_is_safe_ENOSPC(tmpdir, monkeypatch):
|
||||
contents = b"Hello, world\n"
|
||||
victim = tmpdir / "victim"
|
||||
victim.write_binary(contents)
|
||||
hard_link = tmpdir / "hardlink"
|
||||
hard_link.mklinkto(victim)
|
||||
os.link(str(victim), str(hard_link)) # hard_link.mklinkto is not implemented on win32
|
||||
|
||||
def os_unlink(_):
|
||||
raise OSError(errno.ENOSPC, "Pretend that we ran out of space")
|
||||
|
|
Loading…
Reference in New Issue