Repository: borgbackup/borg

Issue:
Disable monkey-patchy archiver tests for binary
These two can't work with the binary, since they're using patch:

```
[gw3] freebsd10 -- Python 3.4.0 /vagrant/borg/borg/.tox/py34/bin/python3.4
self = <borg.testsuite.archiver.ArchiverTestCaseBinary testMethod=test_extract_capabilities>

    @pytest.mark.skipif(not xattr.XATTR_FAKEROOT, reason='Linux capabilities test, requires fakeroot >= 1.20.2')
    def test_extract_capabilities(self):
        fchown = os.fchown
    
        # We need to manually patch chown to get the behaviour Linux has, since fakeroot does not
        # accurately model the interaction of chown(2) and Linux capabilities, i.e. it does not remove them.
        def patched_fchown(fd, uid, gid):
            xattr.setxattr(fd, 'security.capability', None, follow_symlinks=False)
            fchown(fd, uid, gid)
    
        # The capability descriptor used here is valid and taken from a /usr/bin/ping
        capabilities = b'\x01\x00\x00\x02\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
        self.create_regular_file('file')
        xattr.setxattr('input/file', 'security.capability', capabilities)
        self.cmd('init', '--encryption=repokey', self.repository_location)
        self.cmd('create', self.repository_location + '::test', 'input')
        with changedir('output'):
            with patch.object(os, 'fchown', patched_fchown):
                self.cmd('extract', self.repository_location + '::test')
>           assert xattr.getxattr('input/file', 'security.capability') == capabilities

.tox/py34/lib/python3.4/site-packages/borg/testsuite/archiver.py:1150: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.tox/py34/lib/python3.4/site-packages/borg/xattr.py:356: in getxattr
    n, buf = _getxattr_inner(func, path, name)
.tox/py34/lib/python3.4/site-packages/borg/xattr.py:187: in _getxattr_inner
    n = _check(func(path, name, buf, size), path, detect_buffer_too_small=True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

rv = -1, path = b'input/file', detect_buffer_too_small = True

    def _check(rv, path=None, detect_buffer_too_small=False):
        if rv < 0:
            e = get_errno()
            if detect_buffer_too_small and e == errno.ERANGE:
                # listxattr and getxattr signal with ERANGE that they need a bigger result buffer.
                # setxattr signals this way that e.g. a xattr key name is too long / inacceptable.
                raise BufferTooSmallError
            else:
                try:
                    msg = os.strerror(e)
                except ValueError:
                    msg = ''
                if isinstance(path, int):
                    path = '<FD %d>' % path
>               raise OSError(e, msg, path)
E               OSError: [Errno 87] Attribute not found: b'input/file'

.tox/py34/lib/python3.4/site-packages/borg/xattr.py:155: OSError
_____________________________________________________________________ ArchiverTestCaseBinary.test_extract_xattrs_errors ______________________________________________________________________
[gw2] freebsd10 -- Python 3.4.0 /vagrant/borg/borg/.tox/py34/bin/python3.4
self = <borg.testsuite.archiver.ArchiverTestCaseBinary testMethod=test_extract_xattrs_errors>

    @pytest.mark.skipif(not xattr.XATTR_FAKEROOT, reason='xattr not supported on this system or on this version of'
                                                         'fakeroot')
    def test_extract_xattrs_errors(self):
        def patched_setxattr_E2BIG(*args, **kwargs):
            raise OSError(errno.E2BIG, 'E2BIG')
    
        def patched_setxattr_ENOTSUP(*args, **kwargs):
            raise OSError(errno.ENOTSUP, 'ENOTSUP')
    
        def patched_setxattr_EACCES(*args, **kwargs):
            raise OSError(errno.EACCES, 'EACCES')
    
        self.create_regular_file('file')
        xattr.setxattr('input/file', 'attribute', 'value')
        self.cmd('init', self.repository_location, '-e' 'none')
        self.cmd('create', self.repository_location + '::test', 'input')
        with changedir('output'):
            input_abspath = os.path.abspath('input/file')
            with patch.object(xattr, 'setxattr', patched_setxattr_E2BIG):
>               out = self.cmd('extract', self.repository_location + '::test', exit_code=EXIT_WARNING)

.tox/py34/lib/python3.4/site-packages/borg/testsuite/archiver.py:1171: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.tox/py34/lib/python3.4/site-packages/borg/testsuite/archiver.py:283: in cmd
    self.assert_equal(ret, exit_code)
E AssertionError: 0 != 1
```
(from https://github.com/borgbackup/borg/pull/2497#issuecomment-309249368 )




Discussion:

Resolving patch:
diff --git a/src/borg/testsuite/archiver.py b/src/borg/testsuite/archiver.py
--- a/src/borg/testsuite/archiver.py
+++ b/src/borg/testsuite/archiver.py
@@ -2732,6 +2732,14 @@ class ArchiverTestCaseBinary(ArchiverTestCase):
     def test_init_interrupt(self):
         pass
 
+    @unittest.skip('patches objects')
+    def test_extract_capabilities(self):
+        pass
+
+    @unittest.skip('patches objects')
+    def test_extract_xattrs_errors(self):
+        pass
+
     @unittest.skip('test_basic_functionality seems incompatible with fakeroot and/or the binary.')
     def test_basic_functionality(self):
         pass


Test patch: