Don't use exclude newer manually in test functions (#2697)

With this change, all usages of `EXCLUDE_NEWER` are now in command
wrappers, not in the test functions themselves.

For the venv test, i refactored them into the same kind of test context
abstraction that the other test modules have in the second commit.

The third commit makes`"INSTA_FILTERS` "private", removing the last
remaining individual usage.

Pending windows CI 🤞
This commit is contained in:
konsti 2024-04-01 16:07:25 +02:00 committed by GitHub
parent 9df6e33b85
commit 05ed7ac64b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 338 additions and 562 deletions

View file

@ -15,7 +15,7 @@ use url::Url;
use common::{uv_snapshot, TestContext};
use uv_fs::Simplified;
use crate::common::{get_bin, EXCLUDE_NEWER};
use crate::common::get_bin;
mod common;
@ -3034,7 +3034,7 @@ fn recursive_extras_direct_url() -> Result<()> {
let requirements_in = context.temp_dir.child("requirements.in");
requirements_in.write_str("black[dev] @ ../../scripts/packages/black_editable")?;
let mut command = Command::new(get_bin());
let mut command = context.compile();
if cfg!(all(windows, debug_assertions)) {
// TODO(konstin): Reduce stack usage in debug mode enough that the tests pass with the
// default windows stack of 1MB
@ -3042,19 +3042,13 @@ fn recursive_extras_direct_url() -> Result<()> {
}
uv_snapshot!(context.filters(), command
.arg("pip")
.arg("compile")
.arg(requirements_in.path())
.arg("--cache-dir")
.arg(context.cache_dir.path())
.arg("--exclude-newer")
.arg(EXCLUDE_NEWER)
.env("VIRTUAL_ENV", context.venv.as_os_str()), @r###"
.arg(requirements_in.path())
.current_dir(current_dir().unwrap()), @r###"
success: true
exit_code: 0
----- stdout -----
# This file was autogenerated by uv via the following command:
# uv pip compile [TEMP_DIR]/requirements.in --cache-dir [CACHE_DIR] --exclude-newer 2024-03-25T00:00:00Z
# uv pip compile --cache-dir [CACHE_DIR] --exclude-newer 2024-03-25T00:00:00Z [TEMP_DIR]/requirements.in
aiohttp==3.9.3
# via black
aiosignal==1.3.1
@ -6450,21 +6444,8 @@ fn local_version_of_remote_package() -> Result<()> {
"###);
// Actually install the local dependency
// TODO(zanieb): We should have an `install` utility on the context instead of doing this
let mut command = Command::new(get_bin());
command
.arg("pip")
.arg("install")
.arg(root_path.join("anyio_local"))
.arg("--cache-dir")
.arg(context.cache_dir.path())
.arg("--exclude-newer")
.arg(EXCLUDE_NEWER)
.env("VIRTUAL_ENV", context.venv.as_os_str())
.current_dir(context.temp_dir.path());
if cfg!(all(windows, debug_assertions)) {
command.env("UV_STACK_SIZE", (8 * 1024 * 1024).to_string());
}
let mut command = context.install();
command.arg(root_path.join("anyio_local"));
uv_snapshot!(
context.filters(),
command, @r###"