Replace deprecated tempdir dependency with tempfile (#11588)
`Tempdir` is deprecated, but the functionality has been merged into another crate: `tempfile`. This commit removes all `tempdir` dependencies and replaces them with `tempfile` and the equivalent bindings. Fixes #11560
This commit is contained in:
@@ -64,11 +64,11 @@ macro_rules! difficulty_json_test {
|
||||
|
||||
use std::path::Path;
|
||||
use super::json_difficulty_test;
|
||||
use tempdir::TempDir;
|
||||
use tempfile::TempDir;
|
||||
use json_tests::HookType;
|
||||
|
||||
fn do_json_test<H: FnMut(&str, HookType)>(path: &Path, json_data: &[u8], h: &mut H) -> Vec<String> {
|
||||
let tempdir = TempDir::new("").unwrap();
|
||||
let tempdir = TempDir::new().unwrap();
|
||||
json_difficulty_test(path, json_data, crate::spec::$spec(&tempdir.path()), h)
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ extern crate env_logger;
|
||||
#[cfg(test)]
|
||||
extern crate serde_json;
|
||||
#[cfg(any(test, feature = "tempdir"))]
|
||||
extern crate tempdir;
|
||||
extern crate tempfile;
|
||||
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
//! Set of different helpers for client tests
|
||||
|
||||
extern crate tempfile;
|
||||
|
||||
mod test_client;
|
||||
mod evm_test_client;
|
||||
|
||||
@@ -44,7 +46,7 @@ use kvdb::KeyValueDB;
|
||||
use kvdb_rocksdb::{self, Database, DatabaseConfig};
|
||||
use parking_lot::RwLock;
|
||||
use rlp::{self, RlpStream};
|
||||
use tempdir::TempDir;
|
||||
use self::tempfile::TempDir;
|
||||
use types::{
|
||||
chain_notify::ChainMessageType,
|
||||
transaction::{Action, Transaction, SignedTransaction},
|
||||
@@ -305,8 +307,8 @@ impl BlockChainDB for TestBlockChainDB {
|
||||
|
||||
/// Creates new test instance of `BlockChainDB`
|
||||
pub fn new_db() -> Arc<dyn BlockChainDB> {
|
||||
let blooms_dir = TempDir::new("").unwrap();
|
||||
let trace_blooms_dir = TempDir::new("").unwrap();
|
||||
let blooms_dir = TempDir::new().unwrap();
|
||||
let trace_blooms_dir = TempDir::new().unwrap();
|
||||
|
||||
let db = TestBlockChainDB {
|
||||
blooms: blooms_db::Database::open(blooms_dir.path()).unwrap(),
|
||||
@@ -321,8 +323,8 @@ pub fn new_db() -> Arc<dyn BlockChainDB> {
|
||||
|
||||
/// Creates a new temporary `BlockChainDB` on FS
|
||||
pub fn new_temp_db(tempdir: &Path) -> Arc<dyn BlockChainDB> {
|
||||
let blooms_dir = TempDir::new("").unwrap();
|
||||
let trace_blooms_dir = TempDir::new("").unwrap();
|
||||
let blooms_dir = TempDir::new().unwrap();
|
||||
let trace_blooms_dir = TempDir::new().unwrap();
|
||||
let key_value_dir = tempdir.join("key_value");
|
||||
|
||||
let db_config = DatabaseConfig::with_columns(::db::NUM_COLUMNS);
|
||||
|
||||
@@ -22,7 +22,7 @@ use ethereum_types::{U256, Address};
|
||||
use parity_crypto::publickey::KeyPair;
|
||||
use hash::keccak;
|
||||
use io::IoChannel;
|
||||
use tempdir::TempDir;
|
||||
use tempfile::TempDir;
|
||||
use types::{
|
||||
data_format::DataFormat,
|
||||
ids::BlockId,
|
||||
@@ -75,7 +75,7 @@ fn imports_from_empty() {
|
||||
#[test]
|
||||
fn should_return_registrar() {
|
||||
let db = test_helpers::new_db();
|
||||
let tempdir = TempDir::new("").unwrap();
|
||||
let tempdir = TempDir::new().unwrap();
|
||||
let spec = spec::new_ropsten(&tempdir.path().to_owned());
|
||||
|
||||
let client = Client::new(
|
||||
|
||||
Reference in New Issue
Block a user