Pārlūkot izejas kodu

Merge pull request #7155 from ThomasWaldmann/cygwin-fixes

Cygwin fixes
TW 2 gadi atpakaļ
vecāks
revīzija
a2205439a0

+ 1 - 1
src/borg/platform/__init__.py

@@ -4,7 +4,7 @@ Platform-specific APIs.
 Public APIs are documented in platform.base.
 """
 
-from ..platformflags import is_win32, is_linux, is_freebsd, is_darwin
+from ..platformflags import is_win32, is_linux, is_freebsd, is_darwin, is_cygwin
 
 from .base import ENOATTR, API_VERSION
 from .base import SaveFile, sync_dir, fdatasync, safe_fadvise

+ 2 - 0
src/borg/platformflags.py

@@ -7,6 +7,8 @@ Use these Flags instead of sys.platform.startswith('<OS>') or try/except.
 import sys
 
 is_win32 = sys.platform.startswith("win32")
+is_cygwin = sys.platform.startswith("cygwin")
+
 is_linux = sys.platform.startswith("linux")
 is_freebsd = sys.platform.startswith("freebsd")
 is_darwin = sys.platform.startswith("darwin")

+ 2 - 2
src/borg/testsuite/archiver/__init__.py

@@ -235,10 +235,10 @@ class ArchiverTestCaseBase(BaseTestCase):
             os.mknod("input/bdev", 0o600 | stat.S_IFBLK, os.makedev(10, 20))
             # Char device
             os.mknod("input/cdev", 0o600 | stat.S_IFCHR, os.makedev(30, 40))
-            # File mode
-            os.chmod("input/dir2", 0o555)  # if we take away write perms, we need root to remove contents
             # File owner
             os.chown("input/file1", 100, 200)  # raises OSError invalid argument on cygwin
+            # File mode
+            os.chmod("input/dir2", 0o555)  # if we take away write perms, we need root to remove contents
             have_root = True  # we have (fake)root
         except PermissionError:
             have_root = False

+ 2 - 1
src/borg/testsuite/archiver/create_cmd.py

@@ -13,6 +13,7 @@ import pytest
 from ... import platform
 from ...constants import *  # NOQA
 from ...manifest import Manifest
+from ...platform import is_cygwin
 from ...repository import Repository
 from .. import has_lchflags
 from .. import changedir
@@ -707,7 +708,7 @@ class ArchiverTestCase(ArchiverTestCaseBase):
         output = self.cmd(f"--repo={self.repository_location}", "create", "test3", "input", "--list", "--filter=AM")
         self.assert_in("file1", output)
 
-    @pytest.mark.skipif(not are_fifos_supported(), reason="FIFOs not supported")
+    @pytest.mark.skipif(not are_fifos_supported() or is_cygwin, reason="FIFOs not supported, hangs on cygwin")
     def test_create_read_special_symlink(self):
         from threading import Thread
 

+ 2 - 0
src/borg/testsuite/helpers.py

@@ -42,6 +42,7 @@ from ..helpers import iter_separated
 from ..helpers import eval_escapes
 from ..helpers import safe_unlink
 from ..helpers.passphrase import Passphrase, PasswordRetriesExceeded
+from ..platform import is_cygwin
 
 from . import BaseTestCase, FakeInputs
 
@@ -596,6 +597,7 @@ def test_parse_file_size_invalid(string):
         parse_file_size(string)
 
 
+@pytest.mark.skipif(is_cygwin, reason="ignore slow msgpack on cygwin")
 def test_is_slow_msgpack():
     # we need to import upstream msgpack package here, not helpers.msgpack:
     import msgpack