1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-23 08:16:54 +00:00

Improve robustness of monkey patching borg.constants.PBKDF2_ITERATIONS. And add lots of warnings.

This commit is contained in:
Martin Hostettler 2017-06-10 11:42:42 +02:00
parent 1176a1c4e4
commit 005068dd6d
2 changed files with 10 additions and 6 deletions

View file

@ -2,6 +2,13 @@
import pytest
# IMPORTANT keep this above all other borg imports to avoid inconsistent values
# for `from borg.constants import PBKDF2_ITERATIONS` (or star import) usages before
# this is executed
from borg import constants
# no fixture-based monkey-patching since star-imports are used for the constants module
constants.PBKDF2_ITERATIONS = 1
# needed to get pretty assertion failures in unit tests:
if hasattr(pytest, 'register_assert_rewrite'):
pytest.register_assert_rewrite('borg.testsuite')
@ -14,12 +21,7 @@
from borg.testsuite import has_lchflags, has_llfuse
from borg.testsuite import are_symlinks_supported, are_hardlinks_supported, is_utime_fully_supported
from borg.testsuite.platform import fakeroot_detected, are_acls_working
from borg import xattr, constants
def pytest_configure(config):
# no fixture-based monkey-patching since star-imports are used for the constants module
constants.PBKDF2_ITERATIONS = 1
from borg import xattr
@pytest.fixture(autouse=True)

View file

@ -1,5 +1,7 @@
from distutils.version import LooseVersion
# IMPORTANT keep imports from borg here to a minimum because our testsuite depends on
# beeing able to import borg.constants and then monkey patching borg.constants.PBKDF2_ITERATIONS
from ._version import version as __version__