2.9.1: test_render_pdf fails on illumos
mtelka opened this issue · comments
The test_render_pdf
started to fail on illumos with the pipdeptree 2.9.1 release:
_______________________________ test_render_pdf ________________________________
tmp_path = PosixPath('/tmp/pytest-of-marcel/pytest-60/test_render_pdf0')
mocker = <pytest_mock.plugin.MockerFixture object at 0x7fffaa521a10>
def test_render_pdf(tmp_path: Path, mocker: MockerFixture) -> None:
output = p.dump_graphviz(t, output_format="pdf")
res = tmp_path / "file"
with pytest.raises(OSError, match="Bad file descriptor"): # noqa: PT012, SIM117 # because we reopen the file
with res.open("wb") as buf:
mocker.patch.object(sys, "stdout", buf)
> p.print_graphviz(output)
E OSError: [Errno 9] Bad file number
tests/test_pipdeptree.py:715: OSError
During handling of the above exception, another exception occurred:
tmp_path = PosixPath('/tmp/pytest-of-marcel/pytest-60/test_render_pdf0')
mocker = <pytest_mock.plugin.MockerFixture object at 0x7fffaa521a10>
def test_render_pdf(tmp_path: Path, mocker: MockerFixture) -> None:
output = p.dump_graphviz(t, output_format="pdf")
res = tmp_path / "file"
with pytest.raises(OSError, match="Bad file descriptor"): # noqa: PT012, SIM117 # because we reopen the file
with res.open("wb") as buf:
mocker.patch.object(sys, "stdout", buf)
> p.print_graphviz(output)
E AssertionError: Regex pattern did not match.
E Regex: 'Bad file descriptor'
E Input: '[Errno 9] Bad file number'
tests/test_pipdeptree.py:715: AssertionError
------------------------------ Captured log call -------------------------------
DEBUG graphviz.backend.execute:execute.py:61 run [PosixPath('dot'), '-Kdot', '-Tpdf']
DEBUG graphviz.backend.execute:execute.py:61 run [PosixPath('dot'), '-Kdot', '-Tpdf']
The problem is that the test now expect linux-specific behavior. The difference between linux and illumos is easily visible using the following test (in C):
#include <stdio.h>
#include <string.h>
#include <errno.h>
int main(void)
{
printf("%d: %s\n", EBADF, strerror(EBADF));
}
On linux it prints:
9: Bad file descriptor
On illumos it shows:
9: Bad file number