Skip to content

Commit 095ef89

Browse files
authored
[meta] use camino-tempfile-ext in tests (#2337)
1 parent 87f969a commit 095ef89

File tree

18 files changed

+128
-70
lines changed

18 files changed

+128
-70
lines changed

Cargo.lock

Lines changed: 61 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ bstr = { version = "1.12.0", default-features = false, features = ["std"] }
2323
bytes = "1.10.1"
2424
camino = "1.1.9"
2525
camino-tempfile = "1.1.1"
26+
camino-tempfile-ext = "0.3.0"
2627
cargo_metadata = "0.19.2"
2728
# We specify default-no-update here because if users just run:
2829
#

integration-tests/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ sha2.workspace = true
5050
whoami.workspace = true
5151

5252
[dev-dependencies]
53+
camino-tempfile-ext.workspace = true
5354
cfg-if.workspace = true
5455
cp_r.workspace = true
5556
datatest-stable.workspace = true

integration-tests/tests/datatest/custom_target.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33

44
use crate::helpers::bind_insta_settings;
55
use camino::Utf8Path;
6-
use camino_tempfile::Utf8TempDir;
6+
use camino_tempfile_ext::prelude::*;
77
use integration_tests::nextest_cli::CargoNextestCli;
88
use nextest_metadata::NextestExitCode;
99

1010
pub(crate) fn custom_invalid(path: &Utf8Path, contents: String) -> datatest_stable::Result<()> {
1111
let (_guard, insta_prefix) = bind_insta_settings(path, "snapshots/custom-invalid");
1212

1313
let dir = Utf8TempDir::with_prefix("nextest-custom-target-")?;
14-
let json_path = dir.path().join(path.file_name().unwrap());
15-
std::fs::write(&json_path, contents)?;
14+
let json_path = dir.child(path.file_name().unwrap());
15+
json_path.write_str(&contents)?;
1616

1717
let output = CargoNextestCli::for_test()
1818
.args([

nextest-runner/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ self_update = { workspace = true, optional = true, default-features = true }
135135

136136

137137
[dev-dependencies]
138+
camino-tempfile-ext.workspace = true
138139
color-eyre.workspace = true
139140
fixture-data.workspace = true
140141
indoc.workspace = true

nextest-runner/src/config/archive.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ mod tests {
273273

274274
let workspace_dir = tempdir().unwrap();
275275

276-
let graph = temp_workspace(workspace_dir.path(), config_contents);
276+
let graph = temp_workspace(&workspace_dir, config_contents);
277277

278278
let pcx = ParseContext::new(&graph);
279279

@@ -423,9 +423,8 @@ mod tests {
423423
; "invalid on-missing type")]
424424
fn parse_invalid(config_contents: &str, expected_message: &str) {
425425
let workspace_dir = tempdir().unwrap();
426-
let workspace_path: &Utf8Path = workspace_dir.path();
427426

428-
let graph = temp_workspace(workspace_path, config_contents);
427+
let graph = temp_workspace(&workspace_dir, config_contents);
429428

430429
let pcx = ParseContext::new(&graph);
431430

nextest-runner/src/config/config_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ mod tests {
10901090

10911091
let workspace_dir = tempdir().unwrap();
10921092

1093-
let graph = temp_workspace(workspace_dir.path(), config_contents);
1093+
let graph = temp_workspace(&workspace_dir, config_contents);
10941094
let workspace_root = graph.workspace().root();
10951095
let tool_path = workspace_root.join(".config/tool.toml");
10961096
std::fs::write(&tool_path, tool_config_contents).unwrap();

nextest-runner/src/config/leak_timeout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ mod tests {
176176
) {
177177
let workspace_dir = tempdir().unwrap();
178178

179-
let graph = temp_workspace(workspace_dir.path(), config_contents);
179+
let graph = temp_workspace(&workspace_dir, config_contents);
180180

181181
let pcx = ParseContext::new(&graph);
182182

nextest-runner/src/config/max_fail.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ mod tests {
238238
)]
239239
fn parse_fail_fast(config_contents: &str, expected: MaxFail) {
240240
let workspace_dir = tempdir().unwrap();
241-
let graph = temp_workspace(workspace_dir.path(), config_contents);
241+
let graph = temp_workspace(&workspace_dir, config_contents);
242242

243243
let pcx = ParseContext::new(&graph);
244244

@@ -333,7 +333,7 @@ mod tests {
333333
)]
334334
fn invalid_fail_fast(config_contents: &str, error_str: &str) {
335335
let workspace_dir = tempdir().unwrap();
336-
let graph = temp_workspace(workspace_dir.path(), config_contents);
336+
let graph = temp_workspace(&workspace_dir, config_contents);
337337
let pcx = ParseContext::new(&graph);
338338

339339
let error = NextestConfig::from_sources(

nextest-runner/src/config/overrides.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,6 @@ impl<'de> Deserialize<'de> for PlatformStrings {
886886
mod tests {
887887
use super::*;
888888
use crate::config::{LeakTimeoutResult, NextestConfig, test_helpers::*};
889-
use camino::Utf8Path;
890889
use camino_tempfile::tempdir;
891890
use indoc::indoc;
892891
use std::{num::NonZeroUsize, time::Duration};
@@ -942,7 +941,7 @@ mod tests {
942941

943942
let workspace_dir = tempdir().unwrap();
944943

945-
let graph = temp_workspace(workspace_dir.path(), config_contents);
944+
let graph = temp_workspace(&workspace_dir, config_contents);
946945
let package_id = graph.workspace().iter().next().unwrap().id();
947946

948947
let pcx = ParseContext::new(&graph);
@@ -1219,9 +1218,8 @@ mod tests {
12191218
expected_reports: &[MietteJsonReport],
12201219
) {
12211220
let workspace_dir = tempdir().unwrap();
1222-
let workspace_path: &Utf8Path = workspace_dir.path();
12231221

1224-
let graph = temp_workspace(workspace_path, config_contents);
1222+
let graph = temp_workspace(&workspace_dir, config_contents);
12251223
let pcx = ParseContext::new(&graph);
12261224

12271225
let err = NextestConfig::from_sources(
@@ -1285,7 +1283,7 @@ mod tests {
12851283

12861284
let workspace_dir = tempdir().unwrap();
12871285

1288-
let graph = temp_workspace(workspace_dir.path(), config_contents);
1286+
let graph = temp_workspace(&workspace_dir, config_contents);
12891287
let package_id = graph.workspace().iter().next().unwrap().id();
12901288
let pcx = ParseContext::new(&graph);
12911289

0 commit comments

Comments
 (0)