diff --git a/conftest.py b/conftest.py index b23f30d1a..887aa2833 100644 --- a/conftest.py +++ b/conftest.py @@ -2,6 +2,13 @@ import os 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 @@ setup_logging() 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) diff --git a/src/borg/__init__.py b/src/borg/__init__.py index 33b9616d7..c2b201860 100644 --- a/src/borg/__init__.py +++ b/src/borg/__init__.py @@ -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__