1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-25 01:06:50 +00:00

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.
This commit is contained in:
Thomas Waldmann 2018-11-16 01:30:31 +01:00
parent 55717c4751
commit d0a01c532e
2 changed files with 10 additions and 6 deletions

View file

@ -56,7 +56,7 @@
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 @@ def test_extract_hardlinks(self):
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'],

View file

@ -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])