test_xopen_file is flaky
- Dominant language
- Python
- Stars
- 24
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
Hello. This was reported to Debian here some time ago:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1103077
Now I can reproduce it too. This is how it fails:
```
=================================== FAILURES ===================================
_________________________ XphyleTests.test_xopen_file __________________________
self =
def test_xopen_file(self):
with self.assertRaises(IOError):
xopen("foobar", "r")
path = self.root.make_file(suffix=".gz")
> with xopen(path, "r", context_wrapper=True) as i:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests/test_xphyle.py:197:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
xphyle/__init__.py:191: in __exit__
self.close()
xphyle/__init__.py:241: in close
self._close()
xphyle/__init__.py:248: in _close
self._fileobj.close()
xphyle/formats.py:188: in close
self._raise_if_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self =
def _raise_if_error(self) -> None:
"""Raise EOFError if process is not running anymore and the
exit code is nonzero.
"""
retcode = self.process.poll()
if retcode is not None and retcode != 0: # pragma: no-cover
> raise EOFError(
f"{self.executable_name} process returned non-zero exit code "
f"{retcode}. Is the input file truncated or corrupt?"
)
E EOFError: pigz process returned non-zero exit code 1. Is the input file truncated or corrupt?
xphyle/formats.py:201: EOFError
----------------------------- Captured stderr call -----------------------------
pigz: skipping: /tmp/tmpnrjr6z5c/qv7v_1qm.gz empty
=============================== warnings summary ===============================
xphyle/__init__.py:34
/<>/.pybuild/cpython3_3.13_xphyle/build/xphyle/__init__.py:34: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
import pkg_resources
tests/test_performance.py:84
/<>/.pybuild/cpython3_3.13_xphyle/build/tests/test_performance.py:84: PytestUnknownMarkWarning: Unknown pytest.mark.perf - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.perf
tests/test_performance.py:91
/<>/.pybuild/cpython3_3.13_xphyle/build/tests/test_performance.py:91: PytestUnknownMarkWarning: Unknown pytest.mark.perf - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.html
@pytest.mark.perf
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/test_xphyle.py::XphyleTests::test_xopen_file - EOFError: pigz process returned non-zero exit code 1. Is the input file truncated or corrupt?
= 1 failed, 142 passed, 2 skipped, 2 deselected, 3 warnings, 29 subtests passed in 4.44s =
E: pybuild pybuild:485: test: plugin pyproject failed with: exit code=1: cd /<>/.pybuild/cpython3_3.13_xphyle/build; python3.13 -m pytest -m "not perf" -vv
rm -fr -- /tmp/dh-xdg-rundir-EaxecfFV
dh_auto_test: error: pybuild --test --test-pytest -i python{version} -p "3.14 3.13" --parallel=1 returned exit code 13
make: *** [debian/rules:8: binary] Error 25
dpkg-buildpackage: error: debian/rules binary subprocess failed with exit status 2
```
I tried the build on machines with 1 CPU and 2 CPUs. The failure rate on machines with 1 CPU is a lot higher. Therefore, to reproduce the failure please try on a VM with 1 CPU or just configure GRUB with `GRUB_CMDLINE_LINUX="nr_cpus=1"` and reboot.
Thanks.
Contributor guide
Assessment
This issue has not been assessed yet.