##// END OF EJS Templates
bundle-tests: operate from outside a repository...
bundle-tests: operate from outside a repository We are about to add a test for ssh pull/cloning being denied because of bundle1 usage. For this, it is cleaner to not operate from the clone using http. So we update the test beforehand for clarity. This is more churns that what I'm happy to see on stable, but the rests of the series is worth it in my opinion.

File last commit:

r30435:b86a448a default
r30911:f3c5a8a4 stable
Show More
test_cffi.py
35 lines | 838 B | text/x-python | PythonLexer
import io
try:
import unittest2 as unittest
except ImportError:
import unittest
import zstd
try:
import zstd_cffi
except ImportError:
raise unittest.SkipTest('cffi version of zstd not available')
class TestCFFIWriteToToCDecompressor(unittest.TestCase):
def test_simple(self):
orig = io.BytesIO()
orig.write(b'foo')
orig.write(b'bar')
orig.write(b'foobar' * 16384)
dest = io.BytesIO()
cctx = zstd_cffi.ZstdCompressor()
with cctx.write_to(dest) as compressor:
compressor.write(orig.getvalue())
uncompressed = io.BytesIO()
dctx = zstd.ZstdDecompressor()
with dctx.write_to(uncompressed) as decompressor:
decompressor.write(dest.getvalue())
self.assertEqual(uncompressed.getvalue(), orig.getvalue())