From 73dccce5f596da9dde4ea57a09a638c7cadd1edd Mon Sep 17 00:00:00 2001 From: Jonathan Plasse <13716151+JonathanPlasse@users.noreply.github.com> Date: Sat, 28 Jan 2023 19:32:50 +0100 Subject: [PATCH] Isolate integration tests (#2306) --- ruff_cli/tests/integration_test.rs | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/ruff_cli/tests/integration_test.rs b/ruff_cli/tests/integration_test.rs index ac84f8bfc6..12d452870f 100644 --- a/ruff_cli/tests/integration_test.rs +++ b/ruff_cli/tests/integration_test.rs @@ -14,7 +14,7 @@ const BIN_NAME: &str = "ruff"; #[test] fn test_stdin_success() -> Result<()> { let mut cmd = Command::cargo_bin(BIN_NAME)?; - cmd.args(["-", "--format", "text"]) + cmd.args(["-", "--format", "text", "--isolated"]) .write_stdin("") .assert() .success(); @@ -25,7 +25,7 @@ fn test_stdin_success() -> Result<()> { fn test_stdin_error() -> Result<()> { let mut cmd = Command::cargo_bin(BIN_NAME)?; let output = cmd - .args(["-", "--format", "text"]) + .args(["-", "--format", "text", "--isolated"]) .write_stdin("import os\n") .assert() .failure(); @@ -41,7 +41,14 @@ fn test_stdin_error() -> Result<()> { fn test_stdin_filename() -> Result<()> { let mut cmd = Command::cargo_bin(BIN_NAME)?; let output = cmd - .args(["-", "--format", "text", "--stdin-filename", "F401.py"]) + .args([ + "-", + "--format", + "text", + "--stdin-filename", + "F401.py", + "--isolated", + ]) .write_stdin("import os\n") .assert() .failure(); @@ -58,7 +65,14 @@ fn test_stdin_filename() -> Result<()> { fn test_stdin_json() -> Result<()> { let mut cmd = Command::cargo_bin(BIN_NAME)?; let output = cmd - .args(["-", "--format", "json", "--stdin-filename", "F401.py"]) + .args([ + "-", + "--format", + "json", + "--stdin-filename", + "F401.py", + "--isolated", + ]) .write_stdin("import os\n") .assert() .failure(); @@ -107,7 +121,7 @@ fn test_stdin_json() -> Result<()> { fn test_stdin_autofix() -> Result<()> { let mut cmd = Command::cargo_bin(BIN_NAME)?; let output = cmd - .args(["-", "--format", "text", "--fix"]) + .args(["-", "--format", "text", "--fix", "--isolated"]) .write_stdin("import os\nimport sys\n\nprint(sys.version)\n") .assert() .success(); @@ -122,7 +136,7 @@ fn test_stdin_autofix() -> Result<()> { fn test_stdin_autofix_when_not_fixable_should_still_print_contents() -> Result<()> { let mut cmd = Command::cargo_bin(BIN_NAME)?; let output = cmd - .args(["-", "--format", "text", "--fix"]) + .args(["-", "--format", "text", "--fix", "--isolated"]) .write_stdin("import os\nimport sys\n\nif (1, 2):\n print(sys.version)\n") .assert() .failure(); @@ -137,7 +151,7 @@ fn test_stdin_autofix_when_not_fixable_should_still_print_contents() -> Result<( fn test_stdin_autofix_when_no_issues_should_still_print_contents() -> Result<()> { let mut cmd = Command::cargo_bin(BIN_NAME)?; let output = cmd - .args(["-", "--format", "text", "--fix"]) + .args(["-", "--format", "text", "--fix", "--isolated"]) .write_stdin("import sys\n\nprint(sys.version)\n") .assert() .success(); @@ -152,7 +166,7 @@ fn test_stdin_autofix_when_no_issues_should_still_print_contents() -> Result<()> fn test_show_source() -> Result<()> { let mut cmd = Command::cargo_bin(BIN_NAME)?; let output = cmd - .args(["-", "--format", "text", "--show-source"]) + .args(["-", "--format", "text", "--show-source", "--isolated"]) .write_stdin("l = 1") .assert() .failure();