Merge pull request #594 from stevenroose/tempfile

Replace deprecated tempdir with tempfile
This commit is contained in:
gwenn 2019-11-22 20:25:34 +01:00 committed by GitHub
commit 3ef3c15ebe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 8 deletions

View File

@ -72,7 +72,7 @@ memchr = "2.2.0"
uuid = { version = "0.8", optional = true } uuid = { version = "0.8", optional = true }
[dev-dependencies] [dev-dependencies]
tempdir = "0.3" tempfile = "3.1.0"
lazy_static = "1.0" lazy_static = "1.0"
regex = "1.0" regex = "1.0"
uuid = { version = "0.8", features = ["v4"] } uuid = { version = "0.8", features = ["v4"] }

View File

@ -79,13 +79,13 @@ mod test {
use std::sync::mpsc::sync_channel; use std::sync::mpsc::sync_channel;
use std::thread; use std::thread;
use std::time::Duration; use std::time::Duration;
use tempdir::TempDir; use tempfile;
use crate::{Connection, Error, ErrorCode, Result, TransactionBehavior, NO_PARAMS}; use crate::{Connection, Error, ErrorCode, Result, TransactionBehavior, NO_PARAMS};
#[test] #[test]
fn test_default_busy() { fn test_default_busy() {
let temp_dir = TempDir::new("test_default_busy").unwrap(); let temp_dir = tempfile::tempdir().unwrap();
let path = temp_dir.path().join("test.db3"); let path = temp_dir.path().join("test.db3");
let mut db1 = Connection::open(&path).unwrap(); let mut db1 = Connection::open(&path).unwrap();
@ -106,7 +106,7 @@ mod test {
#[test] #[test]
#[ignore] // FIXME: unstable #[ignore] // FIXME: unstable
fn test_busy_timeout() { fn test_busy_timeout() {
let temp_dir = TempDir::new("test_busy_timeout").unwrap(); let temp_dir = tempfile::tempdir().unwrap();
let path = temp_dir.path().join("test.db3"); let path = temp_dir.path().join("test.db3");
let db2 = Connection::open(&path).unwrap(); let db2 = Connection::open(&path).unwrap();
@ -145,7 +145,7 @@ mod test {
true true
} }
let temp_dir = TempDir::new("test_busy_handler").unwrap(); let temp_dir = tempfile::tempdir().unwrap();
let path = temp_dir.path().join("test.db3"); let path = temp_dir.path().join("test.db3");
let db2 = Connection::open(&path).unwrap(); let db2 = Connection::open(&path).unwrap();

View File

@ -869,7 +869,7 @@ mod test {
use fallible_iterator::FallibleIterator; use fallible_iterator::FallibleIterator;
use std::error::Error as StdError; use std::error::Error as StdError;
use std::fmt; use std::fmt;
use tempdir::TempDir; use tempfile;
// this function is never called, but is still type checked; in // this function is never called, but is still type checked; in
// particular, calls with specific instantiations will require // particular, calls with specific instantiations will require
@ -892,7 +892,7 @@ mod test {
#[test] #[test]
fn test_concurrent_transactions_busy_commit() { fn test_concurrent_transactions_busy_commit() {
use std::time::Duration; use std::time::Duration;
let tmp = TempDir::new("locked").unwrap(); let tmp = tempfile::tempdir().unwrap();
let path = tmp.path().join("transactions.db3"); let path = tmp.path().join("transactions.db3");
Connection::open(&path) Connection::open(&path)
@ -938,7 +938,7 @@ mod test {
#[test] #[test]
fn test_persistence() { fn test_persistence() {
let temp_dir = TempDir::new("test_open_file").unwrap(); let temp_dir = tempfile::tempdir().unwrap();
let path = temp_dir.path().join("test.db3"); let path = temp_dir.path().join("test.db3");
{ {