Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.maint.python > #15646 > unrolled thread

Pytest 8.x bug? "Permission denied: '/tmp/systemd-private-...-systemd-logind.service-.../__init__.py'"

Started byJulian Gilbey <julian@d-and-j.net>
First post2024-03-27 11:20 +0100
Last post2024-03-27 18:20 +0100
Articles 4 — 2 participants

Back to article view | Back to linux.debian.maint.python


Contents

  Pytest 8.x bug?  "Permission denied:  '/tmp/systemd-private-...-systemd-logind.service-.../__init__.py'" Julian Gilbey <julian@d-and-j.net> - 2024-03-27 11:20 +0100
    Re: Pytest 8.x bug?  "Permission denied: '/tmp/systemd-private-...-systemd-logind.service-.../__init__.py'" Timo Röhling <timo@gaussglocke.de> - 2024-03-27 12:10 +0100
      Re: Pytest 8.x bug?  "Permission denied:  '/tmp/systemd-private-...-systemd-logind.service-.../__init__.py'" Julian Gilbey <julian@d-and-j.net> - 2024-03-27 16:40 +0100
      Re: Pytest 8.x bug?  "Permission denied:  '/tmp/systemd-private-...-systemd-logind.service-.../__init__.py'" Julian Gilbey <julian@d-and-j.net> - 2024-03-27 18:20 +0100

#15646 — Pytest 8.x bug? "Permission denied: '/tmp/systemd-private-...-systemd-logind.service-.../__init__.py'"

FromJulian Gilbey <julian@d-and-j.net>
Date2024-03-27 11:20 +0100
SubjectPytest 8.x bug? "Permission denied: '/tmp/systemd-private-...-systemd-logind.service-.../__init__.py'"
Message-ID<ImyxY-20ND-13@gated-at.bofh.it>
I'm stymied by a pytest-related bug.  I thought it was a bug in a
particular pytest plugin (pytest-order), but it's now shown up in
another pytest plugin as well, so I wonder if either there's a bug in
pytest 8.x or something subtle has changed that requires a
modification to the plugins.  I couldn't see anything obvious on the
pytest changelog page, and the error message itself is mysterious to
me.  The bug does not show with pytest 7.4.4, so it is certainly
related to the new pytest version.

It occurs when running a script from within a test, and the error is
when collecting the tests.  Here is an example, taking from the report
I filed at https://github.com/pytest-dev/pytest-order/issues/110

______________________________ ERROR collecting . ______________________________
/usr/lib/python3/dist-packages/pluggy/_hooks.py:501: in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
/usr/lib/python3/dist-packages/pluggy/_manager.py:119: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
/usr/lib/python3/dist-packages/_pytest/python.py:211: in pytest_collect_directory
    if pkginit.is_file():
/usr/lib/python3.12/pathlib.py:894: in is_file
    return S_ISREG(self.stat().st_mode)
/usr/lib/python3.12/pathlib.py:842: in stat
    return os.stat(self, follow_symlinks=follow_symlinks)
E   PermissionError: [Errno 13] Permission denied: '/tmp/systemd-private-2dd08cf217854d6285343c302b696375-systemd-logind.service-qOgrXp/__init__.py'


(That page also has the full autopkgtest log.)  I have no idea why it
is looking at this private systemd directory; it's running under
autopkgtest so HOME should be sane.

Any ideas would be much appreciated, as I would be able to use it to
fix the tests on the other plugin I'm working on as well.

Best wishes,

   Julian

[toc] | [next] | [standalone]


#15647 — Re: Pytest 8.x bug? "Permission denied: '/tmp/systemd-private-...-systemd-logind.service-.../__init__.py'"

FromTimo Röhling <timo@gaussglocke.de>
Date2024-03-27 12:10 +0100
SubjectRe: Pytest 8.x bug? "Permission denied: '/tmp/systemd-private-...-systemd-logind.service-.../__init__.py'"
Message-ID<Imzkm-21k7-3@gated-at.bofh.it>
In reply to#15646
Hi,

Am 27. März 2024 10:59:46 MEZ schrieb Julian Gilbey <julian@d-and-j.net>:
>I'm stymied by a pytest-related bug.  I thought it was a bug in a
>particular pytest plugin (pytest-order), but it's now shown up in
>another pytest plugin as well, so I wonder if either there's a bug in
>pytest 8.x or something subtle has changed that requires a
>modification to the plugins.  I couldn't see anything obvious on the
>pytest changelog page, and the error message itself is mysterious to
>me.  The bug does not show with pytest 7.4.4, so it is certainly
>related to the new pytest version.
I wasn't able to pinpoint the cause yet, but I noticed that the failing sessions have "rootdir: /tmp" instead of the usual /tmp/autopkgtest-lxc.*/downtmp/autopkgtest_tmp/build


Cheers
Timo

[toc] | [prev] | [next] | [standalone]


#15649

FromJulian Gilbey <julian@d-and-j.net>
Date2024-03-27 16:40 +0100
Message-ID<ImDxE-23Jt-19@gated-at.bofh.it>
In reply to#15647
On Wed, Mar 27, 2024 at 11:36:55AM +0100, Timo Röhling wrote:
> Hi,
> 
> Am 27. März 2024 10:59:46 MEZ schrieb Julian Gilbey <julian@d-and-j.net>:
> >I'm stymied by a pytest-related bug.  I thought it was a bug in a
> >particular pytest plugin (pytest-order), but it's now shown up in
> >another pytest plugin as well, so I wonder if either there's a bug in
> >pytest 8.x or something subtle has changed that requires a
> >modification to the plugins.  I couldn't see anything obvious on the
> >pytest changelog page, and the error message itself is mysterious to
> >me.  The bug does not show with pytest 7.4.4, so it is certainly
> >related to the new pytest version.
> I wasn't able to pinpoint the cause yet, but I noticed that the failing sessions have "rootdir: /tmp" instead of the usual /tmp/autopkgtest-lxc.*/downtmp/autopkgtest_tmp/build
> 
> 
> Cheers
> Timo

Hi Timo,

Oh, that is interesting!  Good spot, thank you!  I wonder whether
tmpdir is creating a weird location?  BTW, this problem appears when
running autopkgtest under lxc.  In my other package, the tests passed
when running under sbuild but not with autopkgtest under lxc, which
suggests that there's something weird about the lxc setup.

Best wishes,

   Julian

[toc] | [prev] | [next] | [standalone]


#15651

FromJulian Gilbey <julian@d-and-j.net>
Date2024-03-27 18:20 +0100
Message-ID<ImF6q-24Na-3@gated-at.bofh.it>
In reply to#15647
On Wed, Mar 27, 2024 at 11:36:55AM +0100, Timo Röhling wrote:
> Hi,
> 
> Am 27. März 2024 10:59:46 MEZ schrieb Julian Gilbey <julian@d-and-j.net>:
> >I'm stymied by a pytest-related bug.  I thought it was a bug in a
> >particular pytest plugin (pytest-order), but it's now shown up in
> >another pytest plugin as well, so I wonder if either there's a bug in
> >pytest 8.x or something subtle has changed that requires a
> >modification to the plugins.  I couldn't see anything obvious on the
> >pytest changelog page, and the error message itself is mysterious to
> >me.  The bug does not show with pytest 7.4.4, so it is certainly
> >related to the new pytest version.
> I wasn't able to pinpoint the cause yet, but I noticed that the failing sessions have "rootdir: /tmp" instead of the usual /tmp/autopkgtest-lxc.*/downtmp/autopkgtest_tmp/build

Ah, I think you've hit the nail on the head!!

https://github.com/pytest-dev/pytest/issues/11781

And then pytest looks for any __init__.py file it can find, including
in unreadable directories...

Unfortunately, changing the argument from str(tmpdir) to
f"--rootdir={tmpdir}" caused my computer to crash (CPU usage went
through the roof until the computer became unresponsive) - clearly
there's something not quite right here yet!!

Best wishes,

   Julian

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.maint.python


csiph-web