From 7ff8e2fcc70345594b00319b4853755cfd4d4367 Mon Sep 17 00:00:00 2001 From: rzmk Date: Thu, 6 Jul 2023 14:34:54 -0400 Subject: [PATCH 01/15] describegpt: add describegpt to tests.rs --- tests/tests.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/tests.rs b/tests/tests.rs index bc613f7e0..f2ef12b7e 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -42,6 +42,7 @@ mod test_combos; mod test_comments; mod test_count; mod test_dedup; +mod test_describegpt; mod test_diff; #[cfg(any(feature = "feature_capable", feature = "lite"))] mod test_enumerate; From 7100ac112db1a917323263b4d5d643d400c3ff95 Mon Sep 17 00:00:00 2001 From: rzmk Date: Fri, 7 Jul 2023 05:42:11 -0400 Subject: [PATCH 02/15] describegpt: invalid_api_key test --- tests/test_describegpt.rs | 185 ++++---------------------------------- 1 file changed, 16 insertions(+), 169 deletions(-) diff --git a/tests/test_describegpt.rs b/tests/test_describegpt.rs index f4bcb7474..091bea109 100644 --- a/tests/test_describegpt.rs +++ b/tests/test_describegpt.rs @@ -1,8 +1,11 @@ use crate::{qcheck, workdir::Workdir, CsvData}; +// Providing an invalid API key with --openai-key without +// the environment variable set should result in an error #[test] -fn count_simple() { - let wrk = Workdir::new("count_simple"); +fn invalid_api_key() { + let wrk = Workdir::new("invalid_api_key"); + // Create a CSV file with sample data wrk.create_indexed( "in.csv", vec![ @@ -12,172 +15,16 @@ fn count_simple() { svec!["gamma", "37"], ], ); - let mut cmd = wrk.command("count"); - cmd.arg("in.csv"); - let got: String = wrk.stdout(&mut cmd); - let expected = "3"; - assert_eq!(got, expected.to_string()); -} - -#[test] -fn count_width() { - let wrk = Workdir::new("count_width"); - wrk.create_indexed( - "in.csv", - vec![ - svec!["letter", "number"], - svec!["alpha", "13"], - svec!["beta", "24"], - ], - ); - let mut cmd = wrk.command("count"); - cmd.arg("--width").arg("in.csv"); - - let got: String = wrk.stdout(&mut cmd); - let expected = "2;9"; - assert_eq!(got, expected.to_string()); -} - -#[test] -fn count_comments() { - let wrk = Workdir::new("count_comments"); - - wrk.create( - "in.csv", - vec![ - svec!["# this is a comment", ""], - svec!["# next comment", ""], - svec!["letter", "number"], - svec!["alpha", "13"], - svec!["beta", "24"], - svec!["# comment here too!", "24"], - ], - ); - let mut cmd = wrk.command("count"); - cmd.arg("in.csv").env("QSV_COMMENT_CHAR", "#"); - - let got: String = wrk.stdout(&mut cmd); - let expected = "2"; - assert_eq!(got, expected.to_string()); -} - -/// This tests whether `qsv count` gets the right answer. -/// -/// It does some simple case analysis to handle whether we want to test counts -/// in the presence of headers and/or indexes. -fn prop_count_len( - name: &str, - rows: CsvData, - headers: bool, - idx: bool, - noheaders_env: bool, - human_readable: bool, -) -> bool { - let mut expected_count = rows.len(); - if headers && expected_count > 0 { - expected_count -= 1; - } - - let wrk = Workdir::new(name); - if idx { - wrk.create_indexed("in.csv", rows); - } else { - wrk.create("in.csv", rows); - } - - let mut cmd = wrk.command("count"); - if !headers { - cmd.arg("--no-headers"); - } - if noheaders_env { - cmd.env("QSV_NO_HEADERS", "1"); - } - if human_readable { - cmd.arg("--human-readable"); - } - cmd.arg("in.csv"); - - if human_readable { - use thousands::Separable; - - let got_count: String = wrk.stdout(&mut cmd); - let expected_count_commas = expected_count.separate_with_commas(); - - rassert_eq!(got_count, expected_count_commas) - } else { - let got_count: usize = wrk.stdout(&mut cmd); - rassert_eq!(got_count, expected_count) - } -} - -#[test] -fn prop_count() { - fn p(rows: CsvData) -> bool { - prop_count_len("prop_count", rows, false, false, false, false) - } - qcheck(p as fn(CsvData) -> bool); -} - -#[test] -fn prop_count_human_readable() { - fn p(rows: CsvData) -> bool { - prop_count_len("prop_count", rows, false, false, false, true) - } - qcheck(p as fn(CsvData) -> bool); -} - -#[test] -fn prop_count_headers() { - fn p(rows: CsvData) -> bool { - prop_count_len("prop_count_headers", rows, true, false, false, false) - } - qcheck(p as fn(CsvData) -> bool); -} - -#[test] -fn prop_count_headers_human_readable() { - fn p(rows: CsvData) -> bool { - prop_count_len("prop_count_headers", rows, true, false, false, true) - } - qcheck(p as fn(CsvData) -> bool); -} - -#[test] -fn prop_count_indexed() { - fn p(rows: CsvData) -> bool { - prop_count_len("prop_count_indexed", rows, false, true, false, false) - } - qcheck(p as fn(CsvData) -> bool); -} - -#[test] -fn prop_count_indexed_headers() { - fn p(rows: CsvData) -> bool { - prop_count_len("prop_count_indexed_headers", rows, true, true, false, false) - } - qcheck(p as fn(CsvData) -> bool); -} - -#[test] -fn prop_count_noheaders_env() { - fn p(rows: CsvData) -> bool { - prop_count_len("prop_count_noheaders_env", rows, false, false, true, false) - } - qcheck(p as fn(CsvData) -> bool); -} - -#[test] -fn prop_count_noheaders_indexed_env() { - fn p(rows: CsvData) -> bool { - prop_count_len( - "prop_count_noheaders_indexed_env", - rows, - false, - true, - true, - false, - ) - } - qcheck(p as fn(CsvData) -> bool); + // Run the command + let mut cmd = wrk.command("describegpt"); + cmd.arg("--all") + .arg("--json") + .args(["--openai-key", "INVALIDKEY"]) + .arg("in.csv"); + + // Error message + let got_stderr = wrk.output_stderr(&mut cmd); + // Check that we receive the correct error message + assert!(got_stderr.contains("Incorrect API key provided: INVALIDKEY")); } From ecc217e0ac7c575a72181fe32815a4309d28173a Mon Sep 17 00:00:00 2001 From: rzmk Date: Fri, 7 Jul 2023 07:07:30 -0400 Subject: [PATCH 03/15] describegpt: add valid and valid JSON tests --- tests/test_describegpt.rs | 63 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 60 insertions(+), 3 deletions(-) diff --git a/tests/test_describegpt.rs b/tests/test_describegpt.rs index 091bea109..5f1aea043 100644 --- a/tests/test_describegpt.rs +++ b/tests/test_describegpt.rs @@ -1,10 +1,10 @@ -use crate::{qcheck, workdir::Workdir, CsvData}; +use crate::workdir::Workdir; // Providing an invalid API key with --openai-key without // the environment variable set should result in an error #[test] -fn invalid_api_key() { - let wrk = Workdir::new("invalid_api_key"); +fn describegpt_invalid_api_key() { + let wrk = Workdir::new("describegpt"); // Create a CSV file with sample data wrk.create_indexed( "in.csv", @@ -28,3 +28,60 @@ fn invalid_api_key() { // Check that we receive the correct error message assert!(got_stderr.contains("Incorrect API key provided: INVALIDKEY")); } + +// Valid use of describegpt +#[test] +#[ignore = "Requires environment variable to be set."] +fn describegpt_valid() { + let wrk = Workdir::new("describegpt"); + + // Create a CSV file with sample data + wrk.create_indexed( + "in.csv", + vec![ + svec!["letter", "number"], + svec!["alpha", "13"], + svec!["beta", "24"], + svec!["gamma", "37"], + ], + ); + + // Run the command + let mut cmd = wrk.command("describegpt"); + cmd.arg("--all").arg("in.csv"); + + // Check that the command ran successfully + wrk.assert_success(&mut cmd); +} + +// Valid use of describegpt with --json +#[test] +#[ignore = "Requires environment variable to be set."] +fn describegpt_valid_json() { + let wrk = Workdir::new("describegpt"); + + // Create a CSV file with sample data + wrk.create_indexed( + "in.csv", + vec![ + svec!["letter", "number"], + svec!["alpha", "13"], + svec!["beta", "24"], + svec!["gamma", "37"], + ], + ); + + // Run the command + let mut cmd = wrk.command("describegpt"); + cmd.arg("--all").arg("--json").arg("in.csv"); + + // Check that the output is valid JSON + let got = wrk.stdout::(&mut cmd); + match serde_json::from_str::(&got) { + Ok(_) => (), + Err(e) => assert!(false, "Error parsing JSON: {e}"), + } + + // Check that the command ran successfully + wrk.assert_success(&mut cmd); +} \ No newline at end of file From 52d39f1f10d008c4927dee8c210dc0bbf00779c7 Mon Sep 17 00:00:00 2001 From: rzmk Date: Fri, 7 Jul 2023 07:08:11 -0400 Subject: [PATCH 04/15] describegpt: run cargo +nightly fmt --- tests/test_describegpt.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_describegpt.rs b/tests/test_describegpt.rs index 5f1aea043..971549973 100644 --- a/tests/test_describegpt.rs +++ b/tests/test_describegpt.rs @@ -84,4 +84,4 @@ fn describegpt_valid_json() { // Check that the command ran successfully wrk.assert_success(&mut cmd); -} \ No newline at end of file +} From 86a6dc07ba0c99d3a6ac926db3fe3df1025faa25 Mon Sep 17 00:00:00 2001 From: rzmk Date: Fri, 7 Jul 2023 07:23:16 -0400 Subject: [PATCH 05/15] describegpt: attempt debug with error output --- .github/workflows/rust-qsvlite.yml | 2 +- tests/test_describegpt.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust-qsvlite.yml b/.github/workflows/rust-qsvlite.yml index 27efb982c..7925bfadd 100644 --- a/.github/workflows/rust-qsvlite.yml +++ b/.github/workflows/rust-qsvlite.yml @@ -27,4 +27,4 @@ jobs: with: key: qsvlite-cache - name: Run tests - run: cargo test --verbose --locked --features=lite + run: cargo test --verbose --locked --features=lite -- --no-capture diff --git a/tests/test_describegpt.rs b/tests/test_describegpt.rs index 971549973..89e576128 100644 --- a/tests/test_describegpt.rs +++ b/tests/test_describegpt.rs @@ -25,6 +25,7 @@ fn describegpt_invalid_api_key() { // Error message let got_stderr = wrk.output_stderr(&mut cmd); + println!("{}", got_stderr); // Check that we receive the correct error message assert!(got_stderr.contains("Incorrect API key provided: INVALIDKEY")); } From a6cd071eca8fe6ca8216aa17cf1104bca66b2d81 Mon Sep 17 00:00:00 2001 From: rzmk Date: Fri, 7 Jul 2023 07:27:12 -0400 Subject: [PATCH 06/15] describegpt: fix to --nocapture --- .github/workflows/rust-qsvlite.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust-qsvlite.yml b/.github/workflows/rust-qsvlite.yml index 7925bfadd..c035a0ea0 100644 --- a/.github/workflows/rust-qsvlite.yml +++ b/.github/workflows/rust-qsvlite.yml @@ -27,4 +27,4 @@ jobs: with: key: qsvlite-cache - name: Run tests - run: cargo test --verbose --locked --features=lite -- --no-capture + run: cargo test --verbose --locked --features=lite -- --nocapture From dd6fae7d0a6a6f3ec17fad6120f3099432909aa2 Mon Sep 17 00:00:00 2001 From: rzmk Date: Fri, 7 Jul 2023 11:10:59 -0400 Subject: [PATCH 07/15] describegpt: use canonicalize when getting input --- src/cmd/describegpt.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cmd/describegpt.rs b/src/cmd/describegpt.rs index 2ce85729b..5f6cb01e6 100644 --- a/src/cmd/describegpt.rs +++ b/src/cmd/describegpt.rs @@ -391,6 +391,7 @@ pub fn run(argv: &[&str]) -> CliResult<()> { )?; // safety: we just checked that there is at least one input file let arg_input = work_input[0] + .canonicalize()? .clone() .into_os_string() .into_string() @@ -412,7 +413,7 @@ pub fn run(argv: &[&str]) -> CliResult<()> { .arg(arg_input.clone()) .output() else { - return fail!("Error: Unable to parse stats as &str."); + return fail!("Error: Error while generating stats."); }; // Parse the stats as &str @@ -423,7 +424,7 @@ pub fn run(argv: &[&str]) -> CliResult<()> { // Get frequency from qsv frequency on input file eprintln!("Generating frequency from {arg_input} using qsv frequency..."); let Ok(frequency) = Command::new("qsv").arg("frequency").arg(arg_input).output() else { - return fail!("Error: Unable to get frequency from qsv."); + return fail!("Error: Error while generating frequency."); }; // Parse the frequency as &str From 57822dfcfa54f589dddaf6841977bd7541ea5525 Mon Sep 17 00:00:00 2001 From: rzmk Date: Fri, 7 Jul 2023 11:42:41 -0400 Subject: [PATCH 08/15] describegpt: attempt using current_dir with tmpdir path --- src/cmd/describegpt.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cmd/describegpt.rs b/src/cmd/describegpt.rs index 5f6cb01e6..0d2d443fd 100644 --- a/src/cmd/describegpt.rs +++ b/src/cmd/describegpt.rs @@ -408,6 +408,7 @@ pub fn run(argv: &[&str]) -> CliResult<()> { // Get stats from qsv stats on input file with --everything flag eprintln!("Generating stats from {arg_input} using qsv stats --everything..."); let Ok(stats) = Command::new("qsv") + .current_dir(tmpdir.path()) .arg("stats") .arg("--everything") .arg(arg_input.clone()) @@ -423,7 +424,12 @@ pub fn run(argv: &[&str]) -> CliResult<()> { // Get frequency from qsv frequency on input file eprintln!("Generating frequency from {arg_input} using qsv frequency..."); - let Ok(frequency) = Command::new("qsv").arg("frequency").arg(arg_input).output() else { + let Ok(frequency) = Command::new("qsv") + .current_dir(tmpdir.path()) + .arg("frequency") + .arg(arg_input) + .output() + else { return fail!("Error: Error while generating frequency."); }; From b1febef44ae2f3584bfc76c40369e05602e8a29c Mon Sep 17 00:00:00 2001 From: rzmk Date: Fri, 7 Jul 2023 12:05:07 -0400 Subject: [PATCH 09/15] describegpt: use root for qsv path akin to workdir --- src/cmd/describegpt.rs | 13 +++++++++---- tests/test_describegpt.rs | 7 +++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/cmd/describegpt.rs b/src/cmd/describegpt.rs index 0d2d443fd..268f759f8 100644 --- a/src/cmd/describegpt.rs +++ b/src/cmd/describegpt.rs @@ -405,10 +405,16 @@ pub fn run(argv: &[&str]) -> CliResult<()> { return fail!("Error: --all option cannot be specified with other inference flags."); } + // Get qsv executable's directory + let mut root = env::current_exe() + .unwrap() + .parent() + .expect("executable's directory") + .to_path_buf(); + // Get stats from qsv stats on input file with --everything flag eprintln!("Generating stats from {arg_input} using qsv stats --everything..."); - let Ok(stats) = Command::new("qsv") - .current_dir(tmpdir.path()) + let Ok(stats) = Command::new(root.join("qsv")) .arg("stats") .arg("--everything") .arg(arg_input.clone()) @@ -424,8 +430,7 @@ pub fn run(argv: &[&str]) -> CliResult<()> { // Get frequency from qsv frequency on input file eprintln!("Generating frequency from {arg_input} using qsv frequency..."); - let Ok(frequency) = Command::new("qsv") - .current_dir(tmpdir.path()) + let Ok(frequency) = Command::new(root.join("qsv")) .arg("frequency") .arg(arg_input) .output() diff --git a/tests/test_describegpt.rs b/tests/test_describegpt.rs index 89e576128..ca4f5f1b0 100644 --- a/tests/test_describegpt.rs +++ b/tests/test_describegpt.rs @@ -49,7 +49,7 @@ fn describegpt_valid() { // Run the command let mut cmd = wrk.command("describegpt"); - cmd.arg("--all").arg("in.csv"); + cmd.arg("--all").arg("in.csv").args(["max-tokens", "1000"]); // Check that the command ran successfully wrk.assert_success(&mut cmd); @@ -74,7 +74,10 @@ fn describegpt_valid_json() { // Run the command let mut cmd = wrk.command("describegpt"); - cmd.arg("--all").arg("--json").arg("in.csv"); + cmd.arg("--all") + .arg("--json") + .arg("in.csv") + .args(["max-tokens", "1000"]); // Check that the output is valid JSON let got = wrk.stdout::(&mut cmd); From 984b4f048786d28805fe642043a86999fe931e65 Mon Sep 17 00:00:00 2001 From: rzmk Date: Fri, 7 Jul 2023 12:21:24 -0400 Subject: [PATCH 10/15] describegpt: use root path to qsv directly & --max-tokens to tests --- src/cmd/describegpt.rs | 14 +++----------- tests/test_describegpt.rs | 15 +++++++++------ 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/cmd/describegpt.rs b/src/cmd/describegpt.rs index 268f759f8..f50951c9e 100644 --- a/src/cmd/describegpt.rs +++ b/src/cmd/describegpt.rs @@ -406,15 +406,11 @@ pub fn run(argv: &[&str]) -> CliResult<()> { } // Get qsv executable's directory - let mut root = env::current_exe() - .unwrap() - .parent() - .expect("executable's directory") - .to_path_buf(); + let mut root = env::current_exe().unwrap(); // Get stats from qsv stats on input file with --everything flag eprintln!("Generating stats from {arg_input} using qsv stats --everything..."); - let Ok(stats) = Command::new(root.join("qsv")) + let Ok(stats) = Command::new(root.clone()) .arg("stats") .arg("--everything") .arg(arg_input.clone()) @@ -430,11 +426,7 @@ pub fn run(argv: &[&str]) -> CliResult<()> { // Get frequency from qsv frequency on input file eprintln!("Generating frequency from {arg_input} using qsv frequency..."); - let Ok(frequency) = Command::new(root.join("qsv")) - .arg("frequency") - .arg(arg_input) - .output() - else { + let Ok(frequency) = Command::new(root).arg("frequency").arg(arg_input).output() else { return fail!("Error: Error while generating frequency."); }; diff --git a/tests/test_describegpt.rs b/tests/test_describegpt.rs index ca4f5f1b0..5f78e5bc9 100644 --- a/tests/test_describegpt.rs +++ b/tests/test_describegpt.rs @@ -18,10 +18,11 @@ fn describegpt_invalid_api_key() { // Run the command let mut cmd = wrk.command("describegpt"); - cmd.arg("--all") + cmd.arg("in.csv") + .arg("--all") .arg("--json") .args(["--openai-key", "INVALIDKEY"]) - .arg("in.csv"); + .args(["--max-tokens", "1000"]); // Error message let got_stderr = wrk.output_stderr(&mut cmd); @@ -49,7 +50,9 @@ fn describegpt_valid() { // Run the command let mut cmd = wrk.command("describegpt"); - cmd.arg("--all").arg("in.csv").args(["max-tokens", "1000"]); + cmd.arg("in.csv") + .arg("--all") + .args(["--max-tokens", "1000"]); // Check that the command ran successfully wrk.assert_success(&mut cmd); @@ -74,10 +77,10 @@ fn describegpt_valid_json() { // Run the command let mut cmd = wrk.command("describegpt"); - cmd.arg("--all") + cmd.arg("in.csv") + .arg("--all") .arg("--json") - .arg("in.csv") - .args(["max-tokens", "1000"]); + .args(["--max-tokens", "1000"]); // Check that the output is valid JSON let got = wrk.stdout::(&mut cmd); From 4f830df06816d396b7ad6bed15951c1e8726486d Mon Sep 17 00:00:00 2001 From: rzmk Date: Fri, 7 Jul 2023 12:26:14 -0400 Subject: [PATCH 11/15] describegpt: remove --no-capture & unnecessary mut for root --- .github/workflows/rust-qsvlite.yml | 2 +- src/cmd/describegpt.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust-qsvlite.yml b/.github/workflows/rust-qsvlite.yml index c035a0ea0..27efb982c 100644 --- a/.github/workflows/rust-qsvlite.yml +++ b/.github/workflows/rust-qsvlite.yml @@ -27,4 +27,4 @@ jobs: with: key: qsvlite-cache - name: Run tests - run: cargo test --verbose --locked --features=lite -- --nocapture + run: cargo test --verbose --locked --features=lite diff --git a/src/cmd/describegpt.rs b/src/cmd/describegpt.rs index f50951c9e..748917d63 100644 --- a/src/cmd/describegpt.rs +++ b/src/cmd/describegpt.rs @@ -406,7 +406,7 @@ pub fn run(argv: &[&str]) -> CliResult<()> { } // Get qsv executable's directory - let mut root = env::current_exe().unwrap(); + let root = env::current_exe().unwrap(); // Get stats from qsv stats on input file with --everything flag eprintln!("Generating stats from {arg_input} using qsv stats --everything..."); From b54ca185fa1f8abc8a022704538e22f2b0d763f9 Mon Sep 17 00:00:00 2001 From: rzmk Date: Fri, 7 Jul 2023 12:27:15 -0400 Subject: [PATCH 12/15] describegpt: remove print in invalid_api_key test --- tests/test_describegpt.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_describegpt.rs b/tests/test_describegpt.rs index 5f78e5bc9..eefa431eb 100644 --- a/tests/test_describegpt.rs +++ b/tests/test_describegpt.rs @@ -26,7 +26,6 @@ fn describegpt_invalid_api_key() { // Error message let got_stderr = wrk.output_stderr(&mut cmd); - println!("{}", got_stderr); // Check that we receive the correct error message assert!(got_stderr.contains("Incorrect API key provided: INVALIDKEY")); } From 2ccce0789f961651a40073a350b825ba38d17335 Mon Sep 17 00:00:00 2001 From: rzmk Date: Fri, 7 Jul 2023 12:32:29 -0400 Subject: [PATCH 13/15] describegpt: --user-agent test --- tests/test_describegpt.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/test_describegpt.rs b/tests/test_describegpt.rs index eefa431eb..0c389544e 100644 --- a/tests/test_describegpt.rs +++ b/tests/test_describegpt.rs @@ -3,6 +3,7 @@ use crate::workdir::Workdir; // Providing an invalid API key with --openai-key without // the environment variable set should result in an error #[test] +// #[ignore = "Requires environment variable to NOT be set."] fn describegpt_invalid_api_key() { let wrk = Workdir::new("describegpt"); // Create a CSV file with sample data @@ -30,6 +31,34 @@ fn describegpt_invalid_api_key() { assert!(got_stderr.contains("Incorrect API key provided: INVALIDKEY")); } +// Verify --user-agent is passed to OpenAI +#[test] +#[ignore = "Requires environment variable to be set."] +fn describegpt_user_agent() { + let wrk = Workdir::new("describegpt"); + // Create a CSV file with sample data + wrk.create_indexed( + "in.csv", + vec![ + svec!["letter", "number"], + svec!["alpha", "13"], + svec!["beta", "24"], + svec!["gamma", "37"], + ], + ); + + // Run the command + let mut cmd = wrk.command("describegpt"); + cmd.arg("in.csv") + .arg("--all") + .arg("--json") + .args(["--user-agent", "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion"]) + .args(["--max-tokens", "1000"]); + + // Check that the command ran successfully + wrk.assert_success(&mut cmd); +} + // Valid use of describegpt #[test] #[ignore = "Requires environment variable to be set."] From c4459f85091ae4be17b826ef8fd0dfb59bbaad32 Mon Sep 17 00:00:00 2001 From: rzmk Date: Fri, 7 Jul 2023 12:33:07 -0400 Subject: [PATCH 14/15] describegpt: run cargo +nightly fmt --- tests/test_describegpt.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_describegpt.rs b/tests/test_describegpt.rs index 0c389544e..0b4e1de37 100644 --- a/tests/test_describegpt.rs +++ b/tests/test_describegpt.rs @@ -52,7 +52,10 @@ fn describegpt_user_agent() { cmd.arg("in.csv") .arg("--all") .arg("--json") - .args(["--user-agent", "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion"]) + .args([ + "--user-agent", + "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion", + ]) .args(["--max-tokens", "1000"]); // Check that the command ran successfully From e03c7bbf502b31524169519cf4fba345397b54f5 Mon Sep 17 00:00:00 2001 From: Mueez Khan <30333942+rzmk@users.noreply.github.com> Date: Fri, 7 Jul 2023 12:43:31 -0400 Subject: [PATCH 15/15] describegpt: update comment to specify qsv path not dir --- src/cmd/describegpt.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cmd/describegpt.rs b/src/cmd/describegpt.rs index 748917d63..dfac8e090 100644 --- a/src/cmd/describegpt.rs +++ b/src/cmd/describegpt.rs @@ -405,7 +405,7 @@ pub fn run(argv: &[&str]) -> CliResult<()> { return fail!("Error: --all option cannot be specified with other inference flags."); } - // Get qsv executable's directory + // Get qsv executable's path let root = env::current_exe().unwrap(); // Get stats from qsv stats on input file with --everything flag