mirror of
https://github.com/borgbackup/borg.git
synced 2026-06-13 10:50:21 -04:00
test_with_lock: skip on Haiku OS
This commit is contained in:
parent
4df1a534de
commit
6be6b1d942
2 changed files with 10 additions and 5 deletions
|
|
@ -14,3 +14,4 @@ is_freebsd = sys.platform.startswith("freebsd")
|
|||
is_netbsd = sys.platform.startswith("netbsd")
|
||||
is_openbsd = sys.platform.startswith("openbsd")
|
||||
is_darwin = sys.platform.startswith("darwin")
|
||||
is_haiku = sys.platform.startswith("haiku")
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
||||
import pytest
|
||||
|
||||
from ...constants import * # NOQA
|
||||
from . import cmd, generate_archiver_tests, RK_ENCRYPTION
|
||||
from ...helpers import CommandError
|
||||
from ...platformflags import is_haiku
|
||||
|
||||
pytest_generate_tests = lambda metafunc: generate_archiver_tests(metafunc, kinds="local,remote,binary") # NOQA
|
||||
|
||||
|
|
@ -15,10 +19,15 @@ def test_break_lock(archivers, request):
|
|||
cmd(archiver, "break-lock")
|
||||
|
||||
|
||||
@pytest.mark.skipif(is_haiku, reason="does not find borg python module on Haiku OS")
|
||||
def test_with_lock(tmp_path):
|
||||
repo_path = tmp_path / "repo"
|
||||
env = os.environ.copy()
|
||||
env["BORG_REPO"] = "file://" + str(repo_path)
|
||||
# test debug output:
|
||||
print("sys.path: %r" % sys.path)
|
||||
print("PYTHONPATH: %s" % env.get("PYTHONPATH", ""))
|
||||
print("PATH: %s" % env.get("PATH", ""))
|
||||
command0 = "python3", "-m", "borg", "repo-create", "--encryption=none"
|
||||
# Timings must be adjusted so that command1 keeps running while command2 tries to get the lock,
|
||||
# so that lock acquisition for command2 fails as the test expects it.
|
||||
|
|
@ -28,11 +37,6 @@ def test_with_lock(tmp_path):
|
|||
command2 = "python3", "-c", 'print("second command - should never get executed")'
|
||||
borgwl = "python3", "-m", "borg", "with-lock", f"--lock-wait={lock_wait}"
|
||||
popen_options = dict(stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, env=env)
|
||||
import sys
|
||||
|
||||
print("sys.path: %r" % sys.path)
|
||||
print("PYTHONPATH: %s" % env.get("PYTHONPATH", ""))
|
||||
print("PATH: %s" % env.get("PATH", ""))
|
||||
subprocess.run(command0, env=env, check=True, text=True, capture_output=True)
|
||||
assert repo_path.exists()
|
||||
with subprocess.Popen([*borgwl, *command1], **popen_options) as p1:
|
||||
|
|
|
|||
Loading…
Reference in a new issue