Skip to content

Commit

Permalink
Factor out a builder to handle common integration test arguments (#8733)
Browse files Browse the repository at this point in the history
## Summary

This refactors the `ruff_cli` integration tests to create a new
`RuffCheck` struct -- this holds options to configure the "common case"
flags that we want to pass to Ruff (e.g. `--no-cache`, `--isolated`,
etc). This helps reduce the boilerplate and (IMO) makes it more obvious
what the core logic of each test is by keeping only the "interesting"
parameters.

## Test Plan

`cargo test`
  • Loading branch information
alanhdu authored Nov 22, 2023
1 parent 948094e commit 359a68d
Show file tree
Hide file tree
Showing 2 changed files with 283 additions and 367 deletions.
2 changes: 1 addition & 1 deletion crates/ruff_cli/tests/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ bar = "needs formatting"
#[test]
fn format_warn_stdin_filename_with_files() {
assert_cmd_snapshot!(Command::new(get_cargo_bin(BIN_NAME))
.args(["format", "--stdin-filename", "foo.py"])
.args(["format", "--isolated", "--stdin-filename", "foo.py"])
.arg("foo.py")
.pass_stdin("foo = 1"), @r###"
success: true
Expand Down
Loading

0 comments on commit 359a68d

Please sign in to comment.