mirror of
https://github.com/borgbackup/borg.git
synced 2026-04-24 07:41:05 -04:00
rename test files, fix imports/names
This commit is contained in:
parent
b2bdf5e20e
commit
40dc9dadb4
71 changed files with 38 additions and 36 deletions
|
|
@ -131,10 +131,10 @@ dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
|
|||
"src/borg/cache.py" = ["E501"]
|
||||
"src/borg/helpers/__init__.py" = ["F401"]
|
||||
"src/borg/platform/__init__.py" = ["F401"]
|
||||
"src/borg/testsuite/archiver/disk_full.py" = ["F811"]
|
||||
"src/borg/testsuite/archiver/return_codes.py" = ["F811"]
|
||||
"src/borg/testsuite/benchmark.py" = ["F811"]
|
||||
"src/borg/testsuite/platform.py" = ["F811"]
|
||||
"src/borg/testsuite/archiver/disk_full_test.py" = ["F811"]
|
||||
"src/borg/testsuite/archiver/return_codes_test.py" = ["F811"]
|
||||
"src/borg/testsuite/benchmark_test.py" = ["F811"]
|
||||
"src/borg/testsuite/platform_test.py" = ["F811"]
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
python_files = "testsuite/*.py"
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ import sys
|
|||
import time
|
||||
from unittest import TestResult, TestSuite, defaultTestLoader
|
||||
|
||||
from .testsuite.hashindex import HashIndexDataTestCase, HashIndexRefcountingTestCase, HashIndexTestCase
|
||||
from .testsuite.crypto import CryptoTestCase
|
||||
from .testsuite.chunker import ChunkerTestCase
|
||||
from .testsuite.hashindex_test import HashIndexDataTestCase, HashIndexRefcountingTestCase, HashIndexTestCase
|
||||
from .testsuite.crypto_test import CryptoTestCase
|
||||
from .testsuite.chunker_test import ChunkerTestCase
|
||||
|
||||
SELFTEST_CASES = [
|
||||
HashIndexDataTestCase,
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ from ...repository import Repository
|
|||
from .. import has_lchflags, is_utime_fully_supported, have_fuse_mtime_ns, st_mtime_ns_round, no_selinux
|
||||
from .. import changedir
|
||||
from .. import are_symlinks_supported, are_hardlinks_supported, are_fifos_supported
|
||||
from ..platform import is_win32
|
||||
from ..platform_test import is_win32
|
||||
from ...xattr import get_all
|
||||
|
||||
RK_ENCRYPTION = "--encryption=repokey-aes-ocb"
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ from ...helpers import bin_to_hex, msgpack
|
|||
from ...manifest import Manifest
|
||||
from ...remote import RemoteRepository
|
||||
from ...repository import Repository
|
||||
from ..repository import fchunk
|
||||
from ..repository_test import fchunk
|
||||
from . import cmd, src_file, create_src_archive, open_archive, generate_archiver_tests, RK_ENCRYPTION
|
||||
|
||||
pytest_generate_tests = lambda metafunc: generate_archiver_tests(metafunc, kinds="local,remote,binary") # NOQA
|
||||
|
|
@ -4,7 +4,7 @@ import pstats
|
|||
|
||||
from ...constants import * # NOQA
|
||||
from .. import changedir
|
||||
from ..compress import Compressor
|
||||
from ..compress_test import Compressor
|
||||
from . import cmd, create_test_files, create_regular_file, generate_archiver_tests, RK_ENCRYPTION
|
||||
|
||||
pytest_generate_tests = lambda metafunc: generate_archiver_tests(metafunc, kinds="local,remote,binary") # NOQA
|
||||
|
|
@ -10,7 +10,7 @@ from ...helpers import CommandError
|
|||
from ...helpers import bin_to_hex, hex_to_bin
|
||||
from ...helpers import msgpack
|
||||
from ...repository import Repository
|
||||
from .. import key
|
||||
from ..key_test import TestKey
|
||||
from . import RK_ENCRYPTION, KF_ENCRYPTION, cmd, _extract_repository_id, _set_repository_id, generate_archiver_tests
|
||||
|
||||
pytest_generate_tests = lambda metafunc: generate_archiver_tests(metafunc, kinds="local,remote,binary") # NOQA
|
||||
|
|
@ -133,7 +133,7 @@ def test_key_export_repokey(archivers, request):
|
|||
repo_key = AESOCBRepoKey(repository)
|
||||
repo_key.load(None, Passphrase.env_passphrase())
|
||||
|
||||
backup_key = AESOCBKeyfileKey(key.TestKey.MockRepository())
|
||||
backup_key = AESOCBKeyfileKey(TestKey.MockRepository())
|
||||
backup_key.load(export_file, Passphrase.env_passphrase())
|
||||
|
||||
assert repo_key.crypt_key == backup_key.crypt_key
|
||||
|
|
@ -12,7 +12,7 @@ from ...helpers import flags_noatime, flags_normal
|
|||
from .. import has_lchflags, llfuse
|
||||
from .. import changedir, no_selinux, same_ts_ns
|
||||
from .. import are_symlinks_supported, are_hardlinks_supported, are_fifos_supported
|
||||
from ..platform import fakeroot_detected
|
||||
from ..platform_test import fakeroot_detected
|
||||
from . import RK_ENCRYPTION, cmd, assert_dirs_equal, create_regular_file, create_src_archive, open_archive, src_file
|
||||
from . import requires_hardlinks, _extract_hardlinks_setup, fuse_mount, create_test_files, generate_archiver_tests
|
||||
|
||||
|
|
@ -7,7 +7,7 @@ import pytest
|
|||
|
||||
from ...constants import * # NOQA
|
||||
from ...helpers.time import parse_timestamp
|
||||
from ..platform import is_win32
|
||||
from ..platform_test import is_win32
|
||||
from . import cmd, create_test_files, RK_ENCRYPTION, open_archive, generate_archiver_tests
|
||||
|
||||
pytest_generate_tests = lambda metafunc: generate_archiver_tests(metafunc, kinds="local,remote,binary") # NOQA
|
||||
|
|
@ -11,7 +11,7 @@ import os
|
|||
import pytest
|
||||
|
||||
from .archiver import changedir, cmd_fixture # NOQA
|
||||
from .item import Item
|
||||
from .item_test import Item
|
||||
from ..constants import zeros
|
||||
|
||||
|
||||
|
|
@ -2,8 +2,8 @@ import os
|
|||
|
||||
import pytest
|
||||
|
||||
from .hashindex import H
|
||||
from .key import TestKey
|
||||
from .hashindex_test import H
|
||||
from .key_test import TestKey
|
||||
from ..archive import Statistics
|
||||
from ..cache import AdHocWithFilesCache
|
||||
from ..crypto.key import AESOCBRepoKey
|
||||
|
|
@ -4,7 +4,7 @@ import tempfile
|
|||
|
||||
import pytest
|
||||
|
||||
from .chunker import cf
|
||||
from .chunker_test import cf
|
||||
from ..chunker import Chunker, ChunkerFixed, sparsemap, has_seek_hole, ChunkerFailing
|
||||
from ..constants import * # NOQA
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
from io import BytesIO
|
||||
|
||||
from .chunker import cf
|
||||
from .chunker_test import cf
|
||||
from ..chunker import Chunker
|
||||
from ..crypto.low_level import blake2b_256
|
||||
from ..constants import * # NOQA
|
||||
|
|
@ -17,7 +17,7 @@ setup_logging()
|
|||
|
||||
from borg.testsuite import has_lchflags, has_llfuse, has_pyfuse3 # noqa: E402
|
||||
from borg.testsuite import are_symlinks_supported, are_hardlinks_supported, is_utime_fully_supported # noqa: E402
|
||||
from borg.testsuite.platform import fakeroot_detected # noqa: E402
|
||||
from borg.testsuite.platform_test import fakeroot_detected # noqa: E402
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ from ..legacyremote import LegacyRemoteRepository, InvalidRPCMethod, PathNotAllo
|
|||
from ..legacyrepository import LegacyRepository, LoggedIO
|
||||
from ..legacyrepository import MAGIC, MAX_DATA_SIZE, TAG_DELETE, TAG_PUT2, TAG_PUT, TAG_COMMIT
|
||||
from ..repoobj import RepoObj
|
||||
from .hashindex import H
|
||||
from .hashindex_test import H
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
|
|
@ -19,21 +19,23 @@ def io_logger():
|
|||
|
||||
def test_setup_logging(io_logger):
|
||||
logger.info("hello world")
|
||||
assert io_logger.getvalue() == "borg.testsuite.logger: hello world\n"
|
||||
assert io_logger.getvalue() == "borg.testsuite.logger_test: hello world\n"
|
||||
|
||||
|
||||
def test_multiple_loggers(io_logger):
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.info("hello world 1")
|
||||
assert io_logger.getvalue() == "borg.testsuite.logger: hello world 1\n"
|
||||
logger = logging.getLogger("borg.testsuite.logger")
|
||||
assert io_logger.getvalue() == "borg.testsuite.logger_test: hello world 1\n"
|
||||
logger = logging.getLogger("borg.testsuite.logger_test")
|
||||
logger.info("hello world 2")
|
||||
assert io_logger.getvalue() == "borg.testsuite.logger: hello world 1\nborg.testsuite.logger: hello world 2\n"
|
||||
assert (
|
||||
io_logger.getvalue() == "borg.testsuite.logger_test: hello world 1\nborg.testsuite.logger_test: hello world 2\n"
|
||||
)
|
||||
io_logger.truncate(0)
|
||||
io_logger.seek(0)
|
||||
logger = logging.getLogger("borg.testsuite.logger")
|
||||
logger = logging.getLogger("borg.testsuite.logger_test")
|
||||
logger.info("hello world 2")
|
||||
assert io_logger.getvalue() == "borg.testsuite.logger: hello world 2\n"
|
||||
assert io_logger.getvalue() == "borg.testsuite.logger_test: hello world 2\n"
|
||||
|
||||
|
||||
def test_parent_module():
|
||||
|
|
@ -2,7 +2,7 @@ import os
|
|||
import tempfile
|
||||
|
||||
from ..platform import acl_get, acl_set
|
||||
from .platform import skipif_not_darwin, skipif_fakeroot_detected, skipif_acls_not_working
|
||||
from .platform_test import skipif_not_darwin, skipif_fakeroot_detected, skipif_acls_not_working
|
||||
|
||||
# set module-level skips
|
||||
pytestmark = [skipif_not_darwin, skipif_fakeroot_detected]
|
||||
|
|
@ -2,7 +2,7 @@ import os
|
|||
import tempfile
|
||||
|
||||
from ..platform import acl_get, acl_set
|
||||
from .platform import skipif_not_freebsd, skipif_acls_not_working
|
||||
from .platform_test import skipif_not_freebsd, skipif_acls_not_working
|
||||
|
||||
# set module-level skips
|
||||
pytestmark = [skipif_not_freebsd]
|
||||
|
|
@ -2,7 +2,7 @@ import os
|
|||
import tempfile
|
||||
|
||||
from ..platform import acl_get, acl_set
|
||||
from .platform import skipif_not_linux, skipif_fakeroot_detected, skipif_acls_not_working, skipif_no_ubel_user
|
||||
from .platform_test import skipif_not_linux, skipif_fakeroot_detected, skipif_acls_not_working, skipif_no_ubel_user
|
||||
|
||||
# set module-level skips
|
||||
pytestmark = [skipif_not_linux, skipif_fakeroot_detected]
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
from ..platform import swidth
|
||||
from .platform import skipif_not_posix
|
||||
from .platform_test import skipif_not_posix
|
||||
|
||||
|
||||
# set module-level skips
|
||||
|
|
@ -8,7 +8,7 @@ from ..platformflags import is_darwin, is_freebsd, is_linux, is_win32
|
|||
from ..platform import acl_get, acl_set
|
||||
from ..platform import get_process_id, process_alive
|
||||
from . import unopened_tempfile
|
||||
from .fslocking import free_pid # NOQA
|
||||
from .fslocking_test import free_pid # NOQA
|
||||
|
||||
|
||||
def fakeroot_detected():
|
||||
|
|
@ -12,9 +12,9 @@ from ..repository import Repository
|
|||
from ..crypto.key import PlaintextKey
|
||||
from ..helpers import IntegrityError
|
||||
from ..repoobj import RepoObj
|
||||
from .hashindex import H
|
||||
from .repository import fchunk, pdchunk
|
||||
from .key import TestKey
|
||||
from .hashindex_test import H
|
||||
from .repository_test import fchunk, pdchunk
|
||||
from .key_test import TestKey
|
||||
|
||||
|
||||
class TestSleepingBandwidthLimiter:
|
||||
|
|
@ -12,7 +12,7 @@ from ..platformflags import is_win32
|
|||
from ..remote import RemoteRepository, InvalidRPCMethod, PathNotAllowed
|
||||
from ..repository import Repository, MAX_DATA_SIZE
|
||||
from ..repoobj import RepoObj
|
||||
from .hashindex import H
|
||||
from .hashindex_test import H
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
Loading…
Reference in a new issue