From 55717c4751b970de86a09e26277b4fdce37effb2 Mon Sep 17 00:00:00 2001
From: Thomas Waldmann <tw@waldmann-edv.de>
Date: Fri, 16 Nov 2018 01:04:56 +0100
Subject: [PATCH 1/2] pytest: use latest version

---
 requirements.d/development.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/requirements.d/development.txt b/requirements.d/development.txt
index 8142f433f..88535435a 100644
--- a/requirements.d/development.txt
+++ b/requirements.d/development.txt
@@ -3,7 +3,7 @@ setuptools_scm
 pip
 virtualenv
 tox
-pytest<4.0.0
+pytest
 pytest-xdist
 pytest-cov
 pytest-benchmark

From d0a01c532ec63b7c5767ae6d5203b042afdbfd79 Mon Sep 17 00:00:00 2001
From: Thomas Waldmann <tw@waldmann-edv.de>
Date: Fri, 16 Nov 2018 01:30:31 +0100
Subject: [PATCH 2/2] pytest4 complains if we directly call the fixture
 function, fixes #4172

just added a normal function with the code, call it from fixture and
also from unittest test method.
---
 src/borg/testsuite/archiver.py |  4 ++--
 src/borg/testsuite/upgrader.py | 12 ++++++++----
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/borg/testsuite/archiver.py b/src/borg/testsuite/archiver.py
index a15df2387..aa3b390b0 100644
--- a/src/borg/testsuite/archiver.py
+++ b/src/borg/testsuite/archiver.py
@@ -56,7 +56,7 @@ from . import has_lchflags, has_llfuse
 from . import BaseTestCase, changedir, environment_variable, no_selinux
 from . import are_symlinks_supported, are_hardlinks_supported, are_fifos_supported, is_utime_fully_supported, is_birthtime_fully_supported
 from .platform import fakeroot_detected
-from .upgrader import attic_repo
+from .upgrader import make_attic_repo
 from . import key
 
 
@@ -2873,7 +2873,7 @@ id: 2 / e29442 3506da 4e1ea7 / 25f62a 5a3d41 - 02
             assert os.stat('input/dir1/source2').st_nlink == 2
 
     def test_detect_attic_repo(self):
-        path = attic_repo(self.repository_path)
+        path = make_attic_repo(self.repository_path)
         cmds = [
             ['create', path + '::test', self.tmpdir],
             ['extract', path + '::test'],
diff --git a/src/borg/testsuite/upgrader.py b/src/borg/testsuite/upgrader.py
index 08c0693bc..5826251cc 100644
--- a/src/borg/testsuite/upgrader.py
+++ b/src/borg/testsuite/upgrader.py
@@ -58,16 +58,20 @@ def key_valid(path):
         return f.read().startswith(KeyfileKey.FILE_ID)
 
 
-@pytest.fixture()
-def attic_repo(tmpdir):
+def make_attic_repo(dir):
     """
     create an attic repo with some stuff in it
 
-    :param tmpdir: path to the repository to be created
+    :param dir: path to the repository to be created
     :returns: path to attic repository
     """
     # there is some stuff in that repo, copied from `RepositoryTestCase.test1`
-    return untar(ATTIC_TAR, str(tmpdir), 'repo')
+    return untar(ATTIC_TAR, str(dir), 'repo')
+
+
+@pytest.fixture()
+def attic_repo(tmpdir):
+    return make_attic_repo(tmpdir)
 
 
 @pytest.fixture(params=[True, False])