indygreg / indygreg/python-zstandard
test failures on s390x
- Dominant language
- C
- Stars
- 642
- Forks
- 116
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 5
Description
I'm getting 11 failed tests on Fedora 32 on s390x architecture. s390x is big-endian, could this be the reason?
```
$ pytest --last-failed
================================================= test session starts ==================================================
platform linux -- Python 3.8.3, pytest-4.6.9, py-1.8.0, pluggy-0.13.0
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/builddir/build/BUILD/zstandard-0.13.0/.hypothesis/examples')
rootdir: /builddir/build/BUILD/zstandard-0.13.0
plugins: xdist-1.31.0, forked-1.1.1, hypothesis-4.23.8
collected 341 items / 330 deselected / 11 selected
run-last-failure: rerun previous 11 failures (skipped 137 files)
tests/test_compressor.py FFFF [ 36%]
tests/test_decompressor.py FFFFFFF [100%]
======================================================= FAILURES =======================================================
__________________________________ TestCompressor_stream_reader.test_constant_methods __________________________________
self =
def test_constant_methods(self):
cctx = zstd.ZstdCompressor()
with cctx.stream_reader(b"boo") as reader:
self.assertTrue(reader.readable())
self.assertFalse(reader.writable())
self.assertFalse(reader.seekable())
self.assertFalse(reader.isatty())
self.assertFalse(reader.closed)
self.assertIsNone(reader.flush())
self.assertFalse(reader.closed)
> self.assertTrue(reader.closed)
E AssertionError: False is not true
tests/test_compressor.py:638: AssertionError
_________________________________ TestCompressor_stream_reader.test_no_context_manager _________________________________
self =
def test_no_context_manager(self):
cctx = zstd.ZstdCompressor()
reader = cctx.stream_reader(b"foo")
reader.read(4)
self.assertFalse(reader.closed)
reader.close()
> self.assertTrue(reader.closed)
E AssertionError: False is not true
tests/test_compressor.py:600: AssertionError
____________________________________ TestCompressor_stream_reader.test_read_closed _____________________________________
self =
def test_read_closed(self):
cctx = zstd.ZstdCompressor()
with cctx.stream_reader(b"foo" * 60) as reader:
reader.close()
> self.assertTrue(reader.closed)
E AssertionError: False is not true
tests/test_compressor.py:645: AssertionError
_______________________________________ TestCompressor_stream_writer.test_close ________________________________________
self =
def test_close(self):
buffer = NonClosingBytesIO()
cctx = zstd.ZstdCompressor(level=1)
writer = cctx.stream_writer(buffer)
writer.write(b"foo" * 1024)
self.assertFalse(writer.closed)
self.assertFalse(buffer.closed)
writer.close()
> self.assertTrue(writer.closed)
E AssertionError: False is not true
tests/test_compressor.py:922: AssertionError
_________________________________ TestDecompressor_stream_reader.test_constant_methods _________________________________
self =
def test_constant_methods(self):
dctx = zstd.ZstdDecompressor()
with dctx.stream_reader(b"foo") as reader:
self.assertFalse(reader.closed)
self.assertTrue(reader.readable())
self.assertFalse(reader.writable())
self.assertTrue(reader.seekable())
self.assertFalse(reader.isatty())
self.assertFalse(reader.closed)
self.assertIsNone(reader.flush())
self.assertFalse(reader.closed)
> self.assertTrue(reader.closed)
E AssertionError: False is not true
tests/test_decompressor.py:351: AssertionError
________________________________ TestDecompressor_stream_reader.test_no_context_manager ________________________________
self =
def test_no_context_manager(self):
source = b"foobar" * 60
cctx = zstd.ZstdCompressor()
frame = cctx.compress(source)
dctx = zstd.ZstdDecompressor()
reader = dctx.stream_reader(frame)
self.assertEqual(reader.read(6), b"foobar")
self.assertEqual(reader.read(18), b"foobar" * 3)
self.assertFalse(reader.closed)
# Calling close prevents subsequent use.
reader.close()
> self.assertTrue(reader.closed)
E AssertionError: False is not true
tests/test_decompressor.py:533: AssertionError
_________________________________ TestDecompressor_stream_reader.test_read_after_exit __________________________________
self =
def test_read_after_exit(self):
cctx = zstd.ZstdCompressor()
frame = cctx.compress(b"foo" * 60)
dctx = zstd.ZstdDecompressor()
with dctx.stream_reader(frame) as reader:
while reader.read(16):
pass
> self.assertTrue(reader.closed)
E AssertionError: False is not true
tests/test_decompressor.py:465: AssertionError
___________________________________ TestDecompressor_stream_reader.test_read_buffer ____________________________________
self =
def test_read_buffer(self):
cctx = zstd.ZstdCompressor()
source = b"".join([b"foo" * 60, b"bar" * 60, b"baz" * 60])
frame = cctx.compress(source)
dctx = zstd.ZstdDecompressor()
with dctx.stream_reader(frame) as reader:
self.assertEqual(reader.tell(), 0)
# We should get entire frame in one read.
result = reader.read(8192)
self.assertEqual(result, source)
self.assertEqual(reader.tell(), len(source))
# Read after EOF should return empty bytes.
self.assertEqual(reader.read(1), b"")
self.assertEqual(reader.tell(), len(result))
> self.assertTrue(reader.closed)
E AssertionError: False is not true
tests/test_decompressor.py:397: AssertionError
___________________________________ TestDecompressor_stream_reader.test_read_closed ____________________________________
self =
def test_read_closed(self):
dctx = zstd.ZstdDecompressor()
with dctx.stream_reader(b"foo") as reader:
reader.close()
> self.assertTrue(reader.closed)
E AssertionError: False is not true
tests/test_decompressor.py:358: AssertionError
___________________________________ TestDecompressor_stream_reader.test_read_stream ____________________________________
self =
def test_read_stream(self):
cctx = zstd.ZstdCompressor()
source = b"".join([b"foo" * 60, b"bar" * 60, b"baz" * 60])
frame = cctx.compress(source)
dctx = zstd.ZstdDecompressor()
with dctx.stream_reader(io.BytesIO(frame)) as reader:
self.assertEqual(reader.tell(), 0)
chunk = reader.read(8192)
self.assertEqual(chunk, source)
self.assertEqual(reader.tell(), len(source))
self.assertEqual(reader.read(1), b"")
self.assertEqual(reader.tell(), len(source))
self.assertFalse(reader.closed)
> self.assertTrue(reader.closed)
E AssertionError: False is not true
tests/test_decompressor.py:434: AssertionError
______________________________________ TestDecompressor_stream_writer.test_close _______________________________________
self =
def test_close(self):
foo = zstd.ZstdCompressor().compress(b"foo")
buffer = NonClosingBytesIO()
dctx = zstd.ZstdDecompressor()
writer = dctx.stream_writer(buffer)
writer.write(foo)
self.assertFalse(writer.closed)
self.assertFalse(buffer.closed)
writer.close()
> self.assertTrue(writer.closed)
E AssertionError: False is not true
tests/test_decompressor.py:944: AssertionError
====================================== 11 failed, 330 deselected in 0.32 seconds =======================================
$
```
Contributor guide
Research direction
Start by reproducing the failures with pytest on s390x, then inspect tests/test_compressor.py and tests/test_decompressor.py around the reported stream reader and writer cases. Compare the closed-state behavior with another architecture and trace the relevant Python/C binding path; done means the 11 reported tests pass without regressing the existing suite.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, python
- Domain
- backend, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100