Skip to content

Commit

Permalink
Replace deprecated tempdir with tempfile
Browse files Browse the repository at this point in the history
  • Loading branch information
mati865 committed Aug 10, 2018
1 parent ddc4ce2 commit 9645027
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion tokio-fs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ tokio-io = { version = "0.1.6", path = "../tokio-io" }

[dev-dependencies]
rand = "0.5"
tempdir = "0.3.7"
tempfile = "3"
tokio-io = { version = "0.1.6", path = "../tokio-io" }
tokio-codec = { version = "0.1.0", path = "../tokio-codec" }
tokio = { version = "0.1.7", path = ".." }
10 changes: 5 additions & 5 deletions tokio-fs/tests/file.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
extern crate futures;
extern crate rand;
extern crate tempdir;
extern crate tempfile;
extern crate tokio_fs;
extern crate tokio_io;
extern crate tokio_threadpool;
Expand All @@ -13,7 +13,7 @@ use futures::Future;
use futures::future::poll_fn;
use futures::sync::oneshot;
use rand::{thread_rng, Rng};
use tempdir::TempDir;
use tempfile::Builder as TmpBuilder;

use std::fs::File as StdFile;
use std::io::{Read, SeekFrom};
Expand All @@ -22,7 +22,7 @@ use std::io::{Read, SeekFrom};
fn read_write() {
const NUM_CHARS: usize = 16 * 1_024;

let dir = TempDir::new("tokio-fs-tests").unwrap();
let dir = TmpBuilder::new().prefix("tokio-fs-tests").tempdir().unwrap();
let file_path = dir.path().join("read_write.txt");

let contents: Vec<u8> = thread_rng().gen_ascii_chars()
Expand Down Expand Up @@ -81,7 +81,7 @@ fn read_write() {

#[test]
fn metadata() {
let dir = TempDir::new("tokio-fs-tests").unwrap();
let dir = TmpBuilder::new().prefix("tokio-fs-tests").tempdir().unwrap();
let file_path = dir.path().join("metadata.txt");

let pool = Builder::new().pool_size(1).build();
Expand Down Expand Up @@ -111,7 +111,7 @@ fn metadata() {

#[test]
fn seek() {
let dir = TempDir::new("tokio-fs-tests").unwrap();
let dir = TmpBuilder::new().prefix("tokio-fs-tests").tempdir().unwrap();
let file_path = dir.path().join("seek.txt");

let pool = Builder::new().pool_size(1).build();
Expand Down
2 changes: 1 addition & 1 deletion tokio-uds/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ tokio-io = { version = "0.1.6", path = "../tokio-io" }

[dev-dependencies]
tokio = { version = "0.1.6", path = "../" }
tempdir = "0.3.7"
tempfile = "3"
6 changes: 3 additions & 3 deletions tokio-uds/tests/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ extern crate futures;
extern crate tokio;
extern crate tokio_uds;

extern crate tempdir;
extern crate tempfile;

use tokio_uds::*;

Expand All @@ -13,7 +13,7 @@ use tokio::runtime::current_thread::Runtime;

use futures::{Future, Stream};
use futures::sync::oneshot;
use tempdir::TempDir;
use tempfile::Builder;

macro_rules! t {
($e:expr) => (match $e {
Expand All @@ -24,7 +24,7 @@ macro_rules! t {

#[test]
fn echo() {
let dir = TempDir::new("tokio-uds-tests").unwrap();
let dir = Builder::new().prefix("tokio-uds-tests").tempdir().unwrap();
let sock_path = dir.path().join("connect.sock");

let mut rt = Runtime::new().unwrap();
Expand Down

0 comments on commit 9645027

Please sign in to comment.