Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review rm_rf handling of FileNotFoundErrors #6044

Merged
merged 1 commit into from Oct 23, 2019

Conversation

@nicoddemus
Copy link
Member

@nicoddemus nicoddemus commented Oct 22, 2019

Also improved the message when we are passed an unknown function.

@blueyed
Copy link
Contributor

@blueyed blueyed commented Oct 22, 2019

Should we add some more context (#5974 (comment))?

@nicoddemus nicoddemus changed the base branch from features to master Oct 23, 2019
@nicoddemus
Copy link
Member Author

@nicoddemus nicoddemus commented Oct 23, 2019

Added a comment adding more context, and also rebased on master as this is actually a bug fix.

Copy link
Member

@asottile asottile left a comment

@nicoddemus nicoddemus merged commit 713b9e5 into pytest-dev:master Oct 23, 2019
6 checks passed
@nicoddemus nicoddemus deleted the rm-rf-review branch Oct 23, 2019
nicoddemus added a commit to nicoddemus/pytest that referenced this issue Oct 23, 2019
Review rm_rf handling of FileNotFoundErrors
Conflicts:
 	 src/_pytest/pathlib.py
  	testing/test_tmpdir.py
nicoddemus added a commit to nicoddemus/pytest that referenced this issue Oct 23, 2019
Review rm_rf handling of FileNotFoundErrors
Conflicts:
 	 src/_pytest/pathlib.py
  	testing/test_tmpdir.py
bors bot added a commit to duckinator/bork that referenced this issue Oct 25, 2019
68: Update pytest to 5.2.2 r=duckinator a=pyup-bot


This PR updates [pytest](https://pypi.org/project/pytest) from **5.2.1** to **5.2.2**.



<details>
  <summary>Changelog</summary>
  
  
   ### 5.2.2
   ```
   =========================

Bug Fixes
---------

- `5206 &lt;https://github.com/pytest-dev/pytest/issues/5206&gt;`_: Fix ``--nf`` to not forget about known nodeids with partial test selection.


- `5906 &lt;https://github.com/pytest-dev/pytest/issues/5906&gt;`_: Fix crash with ``KeyboardInterrupt`` during ``--setup-show``.


- `5946 &lt;https://github.com/pytest-dev/pytest/issues/5946&gt;`_: Fixed issue when parametrizing fixtures with numpy arrays (and possibly other sequence-like types).


- `6044 &lt;https://github.com/pytest-dev/pytest/issues/6044&gt;`_: Properly ignore ``FileNotFoundError`` exceptions when trying to remove old temporary directories,
  for instance when multiple processes try to remove the same directory (common with ``pytest-xdist``
  for example).
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/pytest
  - Changelog: https://pyup.io/changelogs/pytest/
  - Homepage: https://docs.pytest.org/en/latest/
</details>



Co-authored-by: pyup-bot <github-bot@pyup.io>
"(rm_rf) unknown function {} when removing {}:\n{}: {}".format(
path, func, exctype, excvalue
)
)
Copy link
Contributor

@blueyed blueyed Oct 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should not warn on open, should it?

============== test session starts ===============
platform linux -- Python 3.7.4, pytest-4.6.7.dev6+g46aa29ea5.d20191026, py-1.8.1.dev11+g34f716fe, pluggy-0.12.0
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('…/Vcs/pytest/.hypothesis/examples')
rootdir: …/Vcs/pytest, inifile: tox.ini
plugins: hypothesis-4.23.8, forked-1.0.2, repeat-0.8.0, xdist-1.30.1.dev1+g79dd52b.d20191018
collected 7 items / 5 deselected / 2 selected

testing/test_faulthandler.py EE            [100%]

===================== ERRORS =====================
______ ERROR at setup of test_timeout[True] ______
Traceback (most recent call last):
  File "/usr/lib/python3.7/shutil.py", line 426, in _rmtree_safe_fd
    dirfd = os.open(entry.name, os.O_RDONLY, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: '.pytest_cache'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.7/shutil.py", line 494, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/usr/lib/python3.7/shutil.py", line 432, in _rmtree_safe_fd
    _rmtree_safe_fd(dirfd, fullname, onerror)
  File "/usr/lib/python3.7/shutil.py", line 428, in _rmtree_safe_fd
    onerror(os.open, fullname, sys.exc_info())
  File "…/Vcs/pytest/src/_pytest/pathlib.py", line 65, in on_rm_rf_error
    path, func, exctype, excvalue
pytest.PytestWarning: (rm_rf) unknown function /tmp/pytest-of-user/garbage-d7f65083-c870-4de6-8d7c-acf43dbafdf1/test_cache_failure_warns0/.pytest_cache when removing <built-in function open>:
<class 'PermissionError'>: [Errno 13] Permission denied: '.pytest_cache'
_____ ERROR at setup of test_timeout[False] ______
Traceback (most recent call last):
  File "/usr/lib/python3.7/shutil.py", line 426, in _rmtree_safe_fd
    dirfd = os.open(entry.name, os.O_RDONLY, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: '.pytest_cache'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.7/shutil.py", line 494, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/usr/lib/python3.7/shutil.py", line 432, in _rmtree_safe_fd
    _rmtree_safe_fd(dirfd, fullname, onerror)
  File "/usr/lib/python3.7/shutil.py", line 428, in _rmtree_safe_fd
    onerror(os.open, fullname, sys.exc_info())
  File "…/Vcs/pytest/src/_pytest/pathlib.py", line 65, in on_rm_rf_error
    path, func, exctype, excvalue
pytest.PytestWarning: (rm_rf) unknown function /tmp/pytest-of-user/garbage-c10bc5b6-43ba-4bb0-b73d-1ab5d2bbcb1a/test_cache_failure_warns0/.pytest_cache when removing <built-in function open>:
<class 'PermissionError'>: [Errno 13] Permission denied: '.pytest_cache'
============ short test summary info =============
ERROR testing/test_faulthandler.py::test_timeout[True]
ERROR testing/test_faulthandler.py::test_timeout[False]

bors bot added a commit to rehandalal/therapist that referenced this issue Oct 29, 2019
98: Update pytest to 5.2.2 r=rehandalal a=pyup-bot


This PR updates [pytest](https://pypi.org/project/pytest) from **5.2.1** to **5.2.2**.



<details>
  <summary>Changelog</summary>
  
  
   ### 5.2.2
   ```
   =========================

Bug Fixes
---------

- `5206 &lt;https://github.com/pytest-dev/pytest/issues/5206&gt;`_: Fix ``--nf`` to not forget about known nodeids with partial test selection.


- `5906 &lt;https://github.com/pytest-dev/pytest/issues/5906&gt;`_: Fix crash with ``KeyboardInterrupt`` during ``--setup-show``.


- `5946 &lt;https://github.com/pytest-dev/pytest/issues/5946&gt;`_: Fixed issue when parametrizing fixtures with numpy arrays (and possibly other sequence-like types).


- `6044 &lt;https://github.com/pytest-dev/pytest/issues/6044&gt;`_: Properly ignore ``FileNotFoundError`` exceptions when trying to remove old temporary directories,
  for instance when multiple processes try to remove the same directory (common with ``pytest-xdist``
  for example).
   ```
   
  
</details>


 

<details>
  <summary>Links</summary>
  
  - PyPI: https://pypi.org/project/pytest
  - Changelog: https://pyup.io/changelogs/pytest/
  - Homepage: https://docs.pytest.org/en/latest/
</details>



Co-authored-by: pyup-bot <github-bot@pyup.io>
blueyed
Copy link
Contributor

blueyed commented on ba4b8c8 Feb 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicoddemus
Why would two xdist processes race for the same rm_rf? Should they only handle their own dirs?

Also the "more context" link refers to a comment from me that talks about losing the exception context there being bad, i.e. it is not relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants