Skip to content

Conversation

@oconnor663
Copy link
Contributor

@oconnor663 oconnor663 commented Jun 26, 2025

Previously we were using the XDG data dir to avoid symlinks, but there's no particular guarantee that that's not going to be a symlink too. Using the (canonicalized) temp dir by default is also slightly nicer for a couple reasons: It's sometimes faster (an in-memory tempfs on e.g. Arch), and it makes overriding $TMPDIR or %TMP% sufficient to control where tests put temp files, without needing to override UV_INTERNAL__TEST_DIR too.

@oconnor663 oconnor663 temporarily deployed to uv-test-registries June 26, 2025 18:13 — with GitHub Actions Inactive
@zanieb
Copy link
Member

zanieb commented Jun 26, 2025

Don't you need to unset UV_INTERNAL__TEST_DIR to test this?

@oconnor663
Copy link
Contributor Author

https://github.com/astral-sh/uv/actions/runs/15908534044 is a CI run on a scratch branch that uses temp_dir directly without checking UV_INTERNAL__TEST_DIR. It passed except for a cargo shear warning, which is fixed here.

If you think this is a reasonable change, I could go ahead and remove UV_INTERNAL__TEST_DIR entirely as part of this PR?

@oconnor663 oconnor663 temporarily deployed to uv-test-registries June 26, 2025 19:17 — with GitHub Actions Inactive
@oconnor663 oconnor663 marked this pull request as ready for review June 26, 2025 19:29
@oconnor663
Copy link
Contributor Author

Ah no, I'm probably breaking something on Windows. I got lazy and assumed that Windows failures were timeouts after the macOS runner passed. Incorrect!

@oconnor663 oconnor663 temporarily deployed to uv-test-registries June 26, 2025 20:31 — with GitHub Actions Inactive
@oconnor663
Copy link
Contributor Author

Ok, "canonicalize -> simple_canonicalize" fixed it.

Copy link
Member

@zanieb zanieb left a comment

Choose a reason for hiding this comment

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

Fine with me

@zanieb zanieb added the testing Internal testing of behavior label Jun 26, 2025
Previously we were using the XDG data dir to avoid symlinks, but there's no
particular guarantee that that's not going to be a symlink too. Using the
canonicalized temp dir by default is also slightly nicer for a couple reasons:
It's sometimes faster (an in-memory tempfs on e.g. Arch), and it makes
overriding `$TMPDIR` or `%TMP%` sufficient to control where tests put temp
files, without needing to override `UV_INTERNAL__TEST_DIR` too.
@oconnor663 oconnor663 force-pushed the jack/test_buckets_in_tmp branch from 6686bc1 to 33fa9d9 Compare June 26, 2025 21:38
@oconnor663 oconnor663 enabled auto-merge (rebase) June 26, 2025 21:38
@oconnor663 oconnor663 temporarily deployed to uv-test-registries June 26, 2025 21:41 — with GitHub Actions Inactive
@oconnor663 oconnor663 merged commit efc3612 into main Jun 26, 2025
210 of 211 checks passed
@oconnor663 oconnor663 deleted the jack/test_buckets_in_tmp branch June 26, 2025 21:56
ntBre added a commit to astral-sh/ruff that referenced this pull request Jul 17, 2025
## Summary

This came up on
[Discord](https://discord.com/channels/1039017663004942429/1343692072921731082/1395447082520678440)
and also in #19387, but on macOS the tmp directory is a symlink to
`/private/tmp`, which breaks this filter. I'm still not quite sure why
only these tests are affected when we use the `tempdir_filter`
elsewhere, but hopefully this fixes the immediate issue. Just
`tempdir.path().canonicalize()` also worked, but I used `dunce` since
that's what I saw in other tests (I guess it's not _just_ these tests).

Some related links from uv:
-
https://github.com/astral-sh/uv/blob/1b2f212e8b2f91069b858cb7f5905589c9d15add/crates/uv/tests/it/common/mod.rs#L1161-L1178
-
https://github.com/astral-sh/uv/blob/1b2f212e8b2f91069b858cb7f5905589c9d15add/crates/uv/tests/it/common/mod.rs#L424-L438
- astral-sh/uv#14290

Thanks to @zanieb for those!

## Test Plan

I tested the `main` branch on my MacBook and reproduced the test
failure, then confirmed that the tests pass after the change. Now to
make sure it passes on Windows, which caused most of the trouble in the
first PR!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing Internal testing of behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants