New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strip common path prefix #247
base: master
Are you sure you want to change the base?
Conversation
… expression between String and PathBuf
Summary: 1. After gathering paths test files matching the glob pattern and building paths to these test files, relative to a base directory (CARGO_MANIFEST_DIR by default), find the maximum common prefix for all the test cases and strip that prefix from each test case name. 2. Update test cases for #files to strip common prefix from expected paths.
attr.error(&format!("Invalid absolute path {}", e.to_string_lossy())) | ||
})?; | ||
|
||
for (abs_path, relative_path) in abs_paths.iter().zip(relative_paths) { | ||
if !refs.is_valid(&relative_path) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@la10736 this is_valid
applies the original glob pattern path to the truncated path, hence path exclusion will not work after prefix stripping. I will move is_valid
check to before path stripping.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed it in 76671c7: I changed is_valid
-> !is_excluded
and moved is_excluded
into find_paths
, so find_paths
now applies both include
and exclude
globs.
THX for this PR!! Really appreciated! |
No rush and thank you for getting to reviewing it. |
Strip common path prefixes in test case names, generated with macro
#files
.Implementation
After test file paths have been built relative to the base dir (
CARGO_MANIFEST_DIR
), find the maximum common prefix for all test paths and remove this prefix from the test case names.Example
rstest/tests/rstest/mod.rs demonstrates the gist of the change:
Common prefix
_files
is stripped from the paths:Details
#files
have been updated to expect common prefix stripped.#files
.Addresses #212.