mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-02 22:55:08 +00:00
Fix CI by downgrading to cargo insta 1.29.0 (#5589)
Since the (implicit) update to cargo-insta 1.30, CI would pass even when the tests failed. This downgrades to cargo insta 1.29.0 and CI fails again when it should (which i can't show here, because CI needs to pass to merge this PR). I've improved the unreferenced snapshot handling in the process See https://github.com/mitsuhiko/insta/issues/392
This commit is contained in:
parent
efe7c393d1
commit
d0dae7e576
3 changed files with 24 additions and 16 deletions
14
.github/workflows/ci.yaml
vendored
14
.github/workflows/ci.yaml
vendored
|
@ -54,21 +54,19 @@ jobs:
|
||||||
- name: "Install Rust toolchain"
|
- name: "Install Rust toolchain"
|
||||||
run: rustup show
|
run: rustup show
|
||||||
- uses: Swatinem/rust-cache@v2
|
- uses: Swatinem/rust-cache@v2
|
||||||
- run: cargo install cargo-insta
|
# cargo insta 1.30.0 fails for some reason (https://github.com/mitsuhiko/insta/issues/392)
|
||||||
|
- run: cargo install cargo-insta@=1.29.0
|
||||||
- run: pip install black[d]==23.1.0
|
- run: pip install black[d]==23.1.0
|
||||||
- name: "Run tests (Ubuntu)"
|
- name: "Run tests (Ubuntu)"
|
||||||
if: ${{ matrix.os == 'ubuntu-latest' }}
|
if: ${{ matrix.os == 'ubuntu-latest' }}
|
||||||
run: |
|
run: cargo insta test --all --all-features --unreferenced reject
|
||||||
cargo insta test --all --all-features --delete-unreferenced-snapshots
|
|
||||||
git diff --exit-code
|
|
||||||
- name: "Run tests (Windows)"
|
- name: "Run tests (Windows)"
|
||||||
if: ${{ matrix.os == 'windows-latest' }}
|
if: ${{ matrix.os == 'windows-latest' }}
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
# We can't reject unreferenced snapshots on windows because flake8_executable can't run on windows
|
||||||
cargo insta test --all --all-features
|
run: cargo insta test --all --all-features
|
||||||
git diff --exit-code
|
|
||||||
- run: cargo test --package ruff_cli --test black_compatibility_test -- --ignored
|
- run: cargo test --package ruff_cli --test black_compatibility_test -- --ignored
|
||||||
# Skipped as it's currently broken. The resource were moved from the
|
# TODO: Skipped as it's currently broken. The resource were moved from the
|
||||||
# ruff_cli to ruff crate, but this test was not updated.
|
# ruff_cli to ruff crate, but this test was not updated.
|
||||||
if: false
|
if: false
|
||||||
# Check for broken links in the documentation.
|
# Check for broken links in the documentation.
|
||||||
|
|
|
@ -15,7 +15,6 @@ mod search;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use insta::assert_debug_snapshot;
|
|
||||||
use std::fs::{create_dir_all, File};
|
use std::fs::{create_dir_all, File};
|
||||||
use std::io::{self, Write};
|
use std::io::{self, Write};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
@ -129,6 +128,16 @@ mod tests {
|
||||||
env_logger::builder().is_test(true).try_init().ok();
|
env_logger::builder().is_test(true).try_init().ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
macro_rules! assert_debug_snapshot_normalize_paths {
|
||||||
|
($value: ident) => {{
|
||||||
|
// The debug representation for the backslash are two backslashes (escaping)
|
||||||
|
let $value = std::format!("{:#?}", $value).replace("\\\\", "/");
|
||||||
|
// `insta::assert_snapshot` uses the debug representation of the string, which would
|
||||||
|
// be a single line containing `\n`
|
||||||
|
insta::assert_display_snapshot!($value);
|
||||||
|
}};
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn partial_stub_file_exists() -> io::Result<()> {
|
fn partial_stub_file_exists() -> io::Result<()> {
|
||||||
setup();
|
setup();
|
||||||
|
@ -810,7 +819,7 @@ mod tests {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_debug_snapshot!(result);
|
assert_debug_snapshot_normalize_paths!(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -831,7 +840,7 @@ mod tests {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_debug_snapshot!(result);
|
assert_debug_snapshot_normalize_paths!(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -852,7 +861,7 @@ mod tests {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_debug_snapshot!(result);
|
assert_debug_snapshot_normalize_paths!(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -873,7 +882,7 @@ mod tests {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_debug_snapshot!(result);
|
assert_debug_snapshot_normalize_paths!(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -894,7 +903,7 @@ mod tests {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_debug_snapshot!(result);
|
assert_debug_snapshot_normalize_paths!(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -915,7 +924,7 @@ mod tests {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_debug_snapshot!(result);
|
assert_debug_snapshot_normalize_paths!(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -936,6 +945,6 @@ mod tests {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
assert_debug_snapshot!(result);
|
assert_debug_snapshot_normalize_paths!(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
1
ruff.schema.json
generated
1
ruff.schema.json
generated
|
@ -2400,6 +2400,7 @@
|
||||||
"RUF011",
|
"RUF011",
|
||||||
"RUF012",
|
"RUF012",
|
||||||
"RUF013",
|
"RUF013",
|
||||||
|
"RUF014",
|
||||||
"RUF1",
|
"RUF1",
|
||||||
"RUF10",
|
"RUF10",
|
||||||
"RUF100",
|
"RUF100",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue