Make wiremock filter a default filter (#14024)

Make `127.0.0.1:<PORT>` -> ``[LOCALHOST]`` a general test filter, it
simplifies using wiremock and I'm not aware of any false positives.
This commit is contained in:
konsti 2025-06-13 15:51:17 +02:00 committed by GitHub
parent 881e17600f
commit da2eca4e2c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 15 deletions

View File

@ -650,6 +650,8 @@ impl TestContext {
format!("https://raw.githubusercontent.com/astral-sh/packse/{PACKSE_VERSION}/"), format!("https://raw.githubusercontent.com/astral-sh/packse/{PACKSE_VERSION}/"),
"https://raw.githubusercontent.com/astral-sh/packse/PACKSE_VERSION/".to_string(), "https://raw.githubusercontent.com/astral-sh/packse/PACKSE_VERSION/".to_string(),
)); ));
// For wiremock tests
filters.push((r"127\.0\.0\.1:\d*".to_string(), "[LOCALHOST]".to_string()));
Self { Self {
root: ChildPath::new(root.path()), root: ChildPath::new(root.path()),

View File

@ -11453,11 +11453,6 @@ fn add_missing_package_on_pytorch() -> Result<()> {
#[tokio::test] #[tokio::test]
async fn add_unexpected_error_code() -> Result<()> { async fn add_unexpected_error_code() -> Result<()> {
let context = TestContext::new("3.12"); let context = TestContext::new("3.12");
let filters = context
.filters()
.into_iter()
.chain([(r"127\.0\.0\.1(?::\d+)?", "[LOCALHOST]")])
.collect::<Vec<_>>();
let server = MockServer::start().await; let server = MockServer::start().await;
@ -11476,7 +11471,7 @@ async fn add_unexpected_error_code() -> Result<()> {
"# "#
})?; })?;
uv_snapshot!(filters, context.add().arg("anyio").arg("--index").arg(server.uri()), @r" uv_snapshot!(context.filters(), context.add().arg("anyio").arg("--index").arg(server.uri()), @r"
success: false success: false
exit_code: 2 exit_code: 2
----- stdout ----- ----- stdout -----

View File

@ -564,11 +564,6 @@ fn install_requirements_txt() -> Result<()> {
#[tokio::test] #[tokio::test]
async fn install_remote_requirements_txt() -> Result<()> { async fn install_remote_requirements_txt() -> Result<()> {
let context = TestContext::new("3.12"); let context = TestContext::new("3.12");
let filters = context
.filters()
.into_iter()
.chain([(r"127\.0\.0\.1[^\r\n]*", "[LOCALHOST]")])
.collect::<Vec<_>>();
let username = "user"; let username = "user";
let password = "password"; let password = "password";
@ -579,17 +574,17 @@ async fn install_remote_requirements_txt() -> Result<()> {
let mut requirements_url = Url::parse(&format!("{}/requirements.txt", &server_url))?; let mut requirements_url = Url::parse(&format!("{}/requirements.txt", &server_url))?;
// Should fail without credentials // Should fail without credentials
uv_snapshot!(filters, context.pip_install() uv_snapshot!(context.filters(), context.pip_install()
.arg("-r") .arg("-r")
.arg(requirements_url.as_str()) .arg(requirements_url.as_str())
.arg("--strict"), @r###" .arg("--strict"), @r"
success: false success: false
exit_code: 2 exit_code: 2
----- stdout ----- ----- stdout -----
----- stderr ----- ----- stderr -----
error: Error while accessing remote requirements file: `http://[LOCALHOST] error: Error while accessing remote requirements file: `http://[LOCALHOST]/requirements.txt`
"### "
); );
let _ = requirements_url.set_username(username); let _ = requirements_url.set_username(username);