Skip to content

Commit

Permalink
Add sleep to resolve flakes in modified time test
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb committed Jul 25, 2023
1 parent ce5c917 commit a06cbb9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/ruff_cli/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,9 @@ mod tests {
let cache = test_cache.open();

// Write the same contents to the source file (updating the modified time)
// We must sleep for a millisecond or this can happen too fast on some systems resulting in a modified time collision.
// Once `std::fs::File.set_modified` is stable we can use that instead.
std::thread::sleep(std::time::Duration::from_millis(1));
test_cache.write_source_file("source.py", source);

let got_diagnostics = test_cache
Expand Down

0 comments on commit a06cbb9

Please sign in to comment.