Skip to content

rootdir for pytester identified as /tmp when passing a tmpfile in /tmp as part of a argument #11781

Open
@BeyondEvil

Description

@BeyondEvil
  • a detailed description of the bug or problem you are having
  • output of pip list from the virtual environment you are using
  • pytest and operating system versions
  • minimal example if possible

Please feel free to edit the title 😅

This PR made some of my tests start to fail with PermissionError: [Errno 13] Permission denied: '/tmp/snap-private-tmp/__init__.py'

https://github.com/pytest-dev/pytest-metadata/actions/runs/7365057317/job/20046008077

The tests pass against c7ee5599, but fail on this merge.

Running it locally I also get some warnings:

warnings

=============================== warnings summary ===============================
../../../../../../../../../Users/jimbrannlund/dev/pytest/pytest/src/_pytest/config/__init__.py:1211
  /Users/jimbrannlund/dev/pytest/pytest/src/_pytest/config/__init__.py:1211: PytestAssertRewriteWarning: Module already imported so cannot be rewritten: pytest_metadata
    self._mark_plugins_for_rewrite(hook)

../../../../../../../../../Users/jimbrannlund/dev/pytest/pytest/src/_pytest/config/__init__.py:1211
  /Users/jimbrannlund/dev/pytest/pytest/src/_pytest/config/__init__.py:1211: PytestAssertRewriteWarning: Module already imported so cannot be rewritten: tests
    self._mark_plugins_for_rewrite(hook)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

I tried to figure out exactly where it goes wrong, but failed. It's entirely possible there's something wrong in my plugin that was just surfaced by the changes in this PR.

Please let me know what information I can contribute with.

pip list

Package           Version                  Editable project location
----------------- ------------------------ ----------------------------------------------
attrs             21.4.0
black             22.1.0
cfgv              3.3.1
click             8.0.4
distlib           0.3.4
exceptiongroup    1.2.0
filelock          3.6.0
flake8            4.0.1
identify          2.4.12
iniconfig         1.1.1
mccabe            0.6.1
mypy-extensions   0.4.3
nodeenv           1.6.0
packaging         21.3
pathspec          0.9.0
pip               22.0.3
platformdirs      2.5.1
pluggy            1.3.0
pre-commit        2.17.0
py                1.11.0
pycodestyle       2.8.0
pyflakes          2.4.0
pyparsing         3.0.7
pytest            7.2.0.dev1110+gacd445a3f /Users/jimbrannlund/dev/pytest/pytest
pytest-metadata   2.0.4                    /Users/jimbrannlund/dev/pytest/pytest-metadata
PyYAML            6.0
setuptools        60.6.0
six               1.16.0
toml              0.10.2
tomli             2.0.1
tox               3.24.5
typing_extensions 4.1.1
virtualenv        20.14.0
wheel             0.37.1

I've tried the code on python 3.9...3.13 and it fails on all of them.

CI is Linux
Locally I'm on a Mac

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions