businho / pytest-ruff

MIT License
31 stars 9 forks source link

Emergent Access Denied errors on Windows #28

Open jaraco opened 2 months ago

jaraco commented 2 months ago

With the release of pytest-ruff 0.4, when running a sizeable test suite under pytest-xdist on Windows, many failures are emitted. This issue was reported in https://github.com/pypa/setuptools/issues/4467.

It seems that there's a race condition when ruff is invoked in parallel on the same project on Windows. The cache files collide and fail to be saved.

This issue was masked in 0.3.2 because the exit code from ruff was 2 and ignored.

I wonder if pytest-ruff should detect these "errors saving cache" and continue to suppress them. Or maybe ruff should have a separate exit code for "access denied when saving cache" so that "pytest-ruff" can suppress that code.

Thoughts?

jaraco commented 2 months ago

In a conversation with the Ruff team, they've indicated a desire to handle this situation more robustly, so there may be nothing for pytest-ruff to do here.

jaraco commented 2 months ago

Now that ruff has merged a fix, we know the long-term strategy, but there's still an issue for consumers. In particular, setuptools is still pinned against pytest-ruff 0.4. Once the latest ruff is released, setuptools can remove that pin, but will still fail in environments that happen to pick up the latest pytest-ruff but an older version of ruff.

I see that pytest-ruff depends on a very old ruff, so I'm uneasy suggesting that should be bumped to ruff>0.5.1 (once available).

Maybe it's not common enough for an environment to encounter that condition above, so it's not worth addressing.

If we wanted to address this issue in pytest-ruff, we could do so thus:

That would give users of pytest-ruff 0.4.1 (or similar new release) the stable behavior without having to avoid older versions of ruff.

Personally, I'm just happy to "work at head" (expect the latest versions of everything), but others may want to be more precise about the requirements or have pinned behavior on older versions of ruff.

I'll leave it to the maintainer to decide how to proceed.

iurisilvio commented 2 months ago

I think it is a good idea to check ruff output to ignore these known errors. 👍🏻