Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: Replace tempdir with tempfile #380

Merged
merged 1 commit into from
Jan 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 1 addition & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ version = "0.9.0"
[dev-dependencies]
assert_cli = "0.6.3"
pretty_assertions = "0.6.1"
tempdir = "0.3.7"
tempfile = "3.1"

[features]
default = [
Expand Down
5 changes: 2 additions & 3 deletions tests/cargo-upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ use crate::utils::{
};

/// Helper function that copies the workspace test into a temporary directory.
pub fn copy_workspace_test() -> (tempdir::TempDir, String, Vec<String>) {
pub fn copy_workspace_test() -> (tempfile::TempDir, String, Vec<String>) {
// Create a temporary directory and copy in the root manifest, the dummy rust file, and
// workspace member manifests.
let tmpdir = tempdir::TempDir::new("upgrade_workspace")
.expect("failed to construct temporary directory");
let tmpdir = tempfile::tempdir().expect("failed to construct temporary directory");

let (root_manifest_path, workspace_manifest_paths) = {
// Helper to copy in files to the temporary workspace. The standard library doesn't have a
Expand Down
5 changes: 2 additions & 3 deletions tests/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ use std::io::prelude::*;
use std::{env, fs, path::Path, path::PathBuf, process};

/// Create temporary working directory with Cargo.toml manifest
pub fn clone_out_test(source: &str) -> (tempdir::TempDir, String) {
let tmpdir =
tempdir::TempDir::new("cargo-edit-test").expect("failed to construct temporary directory");
pub fn clone_out_test(source: &str) -> (tempfile::TempDir, String) {
let tmpdir = tempfile::tempdir().expect("failed to construct temporary directory");
fs::copy(source, tmpdir.path().join("Cargo.toml"))
.unwrap_or_else(|err| panic!("could not copy test manifest: {}", err));
let path = tmpdir
Expand Down