瀏覽代碼

fix cyclic import issue, fix tests

needed to increase ChunkBuffer size due to increased items stream chunk size
to get the test working.
Thomas Waldmann 8 年之前
父節點
當前提交
42b6a838da
共有 3 個文件被更改,包括 3 次插入3 次删除
  1. 1 1
      src/borg/archive.py
  2. 1 1
      src/borg/helpers.py
  3. 1 1
      src/borg/testsuite/archive.py

+ 1 - 1
src/borg/archive.py

@@ -169,7 +169,7 @@ class DownloadPipeline:
 
 
 class ChunkBuffer:
-    BUFFER_SIZE = 1 * 1024 * 1024
+    BUFFER_SIZE = 8 * 1024 * 1024
 
     def __init__(self, key, chunker_params=ITEMS_CHUNKER_PARAMS):
         self.buffer = BytesIO()

+ 1 - 1
src/borg/helpers.py

@@ -39,7 +39,6 @@ from . import crypto
 from . import hashindex
 from . import shellpattern
 from .constants import *  # NOQA
-from .compress import get_compressor
 
 # meta dict, data bytes
 _Chunk = namedtuple('_Chunk', 'meta data')
@@ -1584,6 +1583,7 @@ class CompressionDecider2:
         return compr_spec, chunk
 
     def heuristic_lz4(self, compr_args, chunk):
+        from .compress import get_compressor
         meta, data = chunk
         lz4 = get_compressor('lz4')
         cdata = lz4.compress(data)

+ 1 - 1
src/borg/testsuite/archive.py

@@ -109,7 +109,7 @@ class ChunkBufferTestCase(BaseTestCase):
         self.assert_equal(data, [Item(internal_dict=d) for d in unpacker])
 
     def test_partial(self):
-        big = "0123456789" * 10000
+        big = "0123456789abcdefghijklmnopqrstuvwxyz" * 25000
         data = [Item(path='full', source=big), Item(path='partial', source=big)]
         cache = MockCache()
         key = PlaintextKey(None)