-
Notifications
You must be signed in to change notification settings - Fork 648
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bring harmony to the test snapshot filtering situation (#2678)
The snapshot filtering situation has gotten way out of hand, with each test hand-rolling it's own filters on top of copied cruft from previous tests. I've attempted to address this holistically: - `TestContext.filters()` has everything you should need - This was introduced a while ago, but needed a few more filters for it to be generalized everywhere - Using `INSTA_FILTERS` is **not recommended** unless you do not want the context filters - It is okay to extend these filters for things unrelated to paths - If you have to write a custom path filter, please highlight it in review so we can address it in the common module - `TestContext.site_packages()` gives cross-platform access to the site-packages directory - Do not manually construct the path to site-packages from the venv - Do not turn off tests on Windows because you manually constructed a Unix path to site-packages - `TestContext.workspace_root` gives access to uv's repository directory - Use this for installing from `scripts/packages/` - If you need coverage for relative paths, copy the test package into the `temp_dir` don't change the working directory of the test fixture There is additional work that can be done here, such as: - Auditing and removing additional uses of `INSTA_FILTERS` - Updating manual construction of `Command` instances to use a utility - The `venv` tests are particularly frightening in their lack of a test context and could use some love - Improving the developer experience i.e. apply context filters to snapshots by default
- Loading branch information
Showing
15 changed files
with
695 additions
and
1,392 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.