mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-06 00:00:10 +02:00
fs: drop deprecated tempdir crate use in tests (#1312)
In particular because it pulls in old rand duplicates. Replace use with tempfile::tempdir() which has been available since tempfile 3.0.0.
This commit is contained in:
committed by
Carl Lerche
parent
61aee5fc28
commit
0de3a69eb4
@@ -32,7 +32,6 @@ tokio-futures = { version = "0.2.0", path = "../tokio-futures" }
|
|||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
rand = "0.7"
|
rand = "0.7"
|
||||||
tempfile = "3"
|
tempfile = "3"
|
||||||
tempdir = "0.3"
|
|
||||||
tokio-codec = { version = "0.2.0", path = "../tokio-codec" }
|
tokio-codec = { version = "0.2.0", path = "../tokio-codec" }
|
||||||
tokio = { version = "0.2.0", path = "../tokio" }
|
tokio = { version = "0.2.0", path = "../tokio" }
|
||||||
futures-channel-preview = "0.3.0-alpha.17"
|
futures-channel-preview = "0.3.0-alpha.17"
|
||||||
|
|||||||
@@ -5,14 +5,14 @@ use futures_util::future;
|
|||||||
use futures_util::try_stream::TryStreamExt;
|
use futures_util::try_stream::TryStreamExt;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
use tempdir::TempDir;
|
use tempfile::tempdir;
|
||||||
use tokio_fs::*;
|
use tokio_fs::*;
|
||||||
|
|
||||||
mod pool;
|
mod pool;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn create() {
|
fn create() {
|
||||||
let base_dir = TempDir::new("base").unwrap();
|
let base_dir = tempdir().unwrap();
|
||||||
let new_dir = base_dir.path().join("foo");
|
let new_dir = base_dir.path().join("foo");
|
||||||
let new_dir_2 = new_dir.clone();
|
let new_dir_2 = new_dir.clone();
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ fn create() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn create_all() {
|
fn create_all() {
|
||||||
let base_dir = TempDir::new("base").unwrap();
|
let base_dir = tempdir().unwrap();
|
||||||
let new_dir = base_dir.path().join("foo").join("bar");
|
let new_dir = base_dir.path().join("foo").join("bar");
|
||||||
let new_dir_2 = new_dir.clone();
|
let new_dir_2 = new_dir.clone();
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ fn create_all() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn remove() {
|
fn remove() {
|
||||||
let base_dir = TempDir::new("base").unwrap();
|
let base_dir = tempdir().unwrap();
|
||||||
let new_dir = base_dir.path().join("foo");
|
let new_dir = base_dir.path().join("foo");
|
||||||
let new_dir_2 = new_dir.clone();
|
let new_dir_2 = new_dir.clone();
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ fn remove() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn read() {
|
fn read() {
|
||||||
let base_dir = TempDir::new("base").unwrap();
|
let base_dir = tempdir().unwrap();
|
||||||
|
|
||||||
let p = base_dir.path();
|
let p = base_dir.path();
|
||||||
fs::create_dir(p.join("aa")).unwrap();
|
fs::create_dir(p.join("aa")).unwrap();
|
||||||
|
|||||||
@@ -4,14 +4,14 @@
|
|||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
use std::io::BufReader;
|
use std::io::BufReader;
|
||||||
use tempdir::TempDir;
|
use tempfile::tempdir;
|
||||||
use tokio_fs::*;
|
use tokio_fs::*;
|
||||||
|
|
||||||
mod pool;
|
mod pool;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_hard_link() {
|
fn test_hard_link() {
|
||||||
let dir = TempDir::new("base").unwrap();
|
let dir = tempdir().unwrap();
|
||||||
let src = dir.path().join("src.txt");
|
let src = dir.path().join("src.txt");
|
||||||
let dst = dir.path().join("dst.txt");
|
let dst = dir.path().join("dst.txt");
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ fn test_hard_link() {
|
|||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
#[test]
|
#[test]
|
||||||
fn test_symlink() {
|
fn test_symlink() {
|
||||||
let dir = TempDir::new("base").unwrap();
|
let dir = tempdir().unwrap();
|
||||||
let src = dir.path().join("src.txt");
|
let src = dir.path().join("src.txt");
|
||||||
let dst = dir.path().join("dst.txt");
|
let dst = dir.path().join("dst.txt");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user