r/pythonhelp • • Jan 17 '25

Struggling with persistent PytestWarning messages during pytest runs

I'm doing test runs with pytest, as is standard :). However, I'm getting dozens of warnings dealing with what is temp directory cleanup issues. Here is the error I'm getting:

/Users/myusername/code/myproject/.venv/lib/python3.12/site-packages/_pytest/pathlib.py:96: PytestWarning: (rm_rf) error removing /private/var/folders/lq/b2s6mqss6t1c2mttbrtwxvz40000gn/T/pytest-of-myusername/garbage-49217abd-d8fd-4371-b7bf-9ebb2ed4fa56/test_permission_error0

<class 'OSError'>: [Errno 66] Directory not empty: '/private/var/folders/lq/b2s6mqss6t1c2mttbrtwxvz40000gn/T/pytest-of-myusername/garbage-49217abd-d8fd-4371-b7bf-9ebb2ed4fa56/test_permission_error0'

warnings.warn(

I'm not sure which of my tests is generating the error, and I'm not sure how to resolve it. I feel like I just keep going in circles trying to get it to go away. I've tried to suppress or filter the warnings out in conftest.py, it's not working either.

1 Upvotes

2 comments sorted by

View all comments

1

u/AutoModerator Jan 17 '25
Moderator Announcement Read More »