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:
marktoda 2020-03-29 13:31:17 -07:00 committed by GitHub
parent 4f26ffd447
commit 2a3217d8d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
76 changed files with 220 additions and 214 deletions

60
Cargo.lock generated
View File

@ -281,7 +281,7 @@ dependencies = [
"parking_lot 0.10.0",
"rlp",
"spec",
"tempdir",
"tempfile",
"validator-set",
]
@ -425,7 +425,7 @@ dependencies = [
"criterion",
"ethbloom",
"parking_lot 0.10.0",
"tempdir",
"tempfile",
]
[[package]]
@ -1119,7 +1119,7 @@ dependencies = [
"rustc-hex 2.1.0",
"serde_json",
"static_assertions",
"tempdir",
"tempfile",
]
[[package]]
@ -1138,7 +1138,7 @@ dependencies = [
"machine",
"rlp",
"spec",
"tempdir",
"tempfile",
"unexpected",
]
@ -1215,7 +1215,7 @@ dependencies = [
"spec",
"state-db",
"stats",
"tempdir",
"tempfile",
"trace",
"trace-time",
"trie-db",
@ -1241,7 +1241,7 @@ dependencies = [
"serde",
"serde_derive",
"serde_json",
"tempdir",
"tempfile",
]
[[package]]
@ -1269,7 +1269,7 @@ dependencies = [
"rlp-derive",
"rlp_compress",
"rustc-hex 2.1.0",
"tempdir",
"tempfile",
"triehash-ethereum",
]
@ -1380,7 +1380,7 @@ dependencies = [
"smallvec 1.2.0",
"spec",
"stats",
"tempdir",
"tempfile",
"trie-db",
"triehash-ethereum",
"verification",
@ -1486,7 +1486,7 @@ dependencies = [
"serde",
"serde_json",
"slab 0.2.0",
"tempdir",
"tempfile",
"tiny-keccak 1.5.0",
]
@ -1560,7 +1560,7 @@ dependencies = [
"log",
"snapshot",
"spec",
"tempdir",
"tempfile",
"trace-time",
]
@ -1704,7 +1704,7 @@ dependencies = [
"serde_derive",
"serde_json",
"smallvec 1.2.0",
"tempdir",
"tempfile",
"time",
"tiny-keccak 1.5.0",
]
@ -1725,7 +1725,7 @@ dependencies = [
"rustc-hex 2.1.0",
"serde",
"serde_derive",
"tempdir",
"tempfile",
]
[[package]]
@ -1767,7 +1767,7 @@ dependencies = [
"serde",
"serde_json",
"spec",
"tempdir",
"tempfile",
"trace",
"vm",
]
@ -1799,7 +1799,7 @@ dependencies = [
"pod",
"spec",
"state-db",
"tempdir",
"tempfile",
"trace",
"trie-db",
"trie-vm-factories",
@ -2808,7 +2808,7 @@ dependencies = [
"rlp",
"spec",
"state-db",
"tempdir",
"tempfile",
"trace",
"trie-vm-factories",
"vm",
@ -2891,7 +2891,7 @@ dependencies = [
"kvdb-rocksdb 0.6.0",
"log",
"maplit",
"tempdir",
"tempfile",
]
[[package]]
@ -3031,7 +3031,7 @@ dependencies = [
"lru-cache",
"parking_lot 0.10.0",
"spec",
"tempdir",
"tempfile",
]
[[package]]
@ -3239,7 +3239,7 @@ dependencies = [
"serde_json",
"snapshot",
"spec",
"tempdir",
"tempfile",
"term_size",
"textwrap 0.9.0",
"toml",
@ -3434,7 +3434,7 @@ dependencies = [
"snapshot",
"spec",
"stats",
"tempdir",
"tempfile",
"tiny-keccak 1.5.0",
"tokio-timer 0.1.2",
"trace",
@ -3582,7 +3582,7 @@ dependencies = [
"rand 0.7.3",
"semver",
"target_info",
"tempdir",
"tempfile",
]
[[package]]
@ -4690,7 +4690,7 @@ dependencies = [
"snapshot-tests",
"spec",
"state-db",
"tempdir",
"tempfile",
"trie-db",
"trie-standardmap",
"triehash-ethereum",
@ -4733,7 +4733,7 @@ dependencies = [
"rlp",
"snapshot",
"spec",
"tempdir",
"tempfile",
"trie-db",
"trie-standardmap",
"triehash-ethereum",
@ -4782,7 +4782,7 @@ dependencies = [
"parity-bytes",
"pod",
"rlp",
"tempdir",
"tempfile",
"trace",
"trie-vm-factories",
"vm",
@ -4918,13 +4918,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c63f48baada5c52e65a29eef93ab4f8982681b67f9e8d29c7b05abcfec2b9ffe"
[[package]]
name = "tempdir"
version = "0.3.7"
name = "tempfile"
version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"
checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
dependencies = [
"rand 0.4.6",
"cfg-if",
"libc",
"rand 0.7.3",
"redox_syscall",
"remove_dir_all",
"winapi 0.3.8",
]
[[package]]
@ -5627,7 +5631,7 @@ dependencies = [
"parking_lot 0.10.0",
"rlp",
"spec",
"tempdir",
"tempfile",
"time-utils",
"triehash-ethereum",
"unexpected",

View File

@ -86,7 +86,7 @@ rustc_version = "0.2"
[dev-dependencies]
pretty_assertions = "0.1"
ipnetwork = "0.12.6"
tempdir = "0.3"
tempfile = "3.1"
fake-fetch = { path = "util/fake-fetch" }
[target.'cfg(windows)'.dependencies]

View File

@ -18,4 +18,4 @@ serde_json = "1.0"
[dev-dependencies]
ethereum-types = "0.8.0"
tempdir = "0.3"
tempfile = "3.1"

View File

@ -22,7 +22,7 @@ ethereum-types = "0.8.0"
dir = { path = "../../util/dir" }
smallvec = "1.2.0"
parity-wordlist = "1.3.1"
tempdir = "0.3"
tempfile = "3.1"
[dev-dependencies]
matches = "0.1"

View File

@ -24,4 +24,4 @@ path = "src/main.rs"
doc = false
[dev-dependencies]
tempdir = "0.3"
tempfile = "3.1"

View File

@ -14,9 +14,9 @@
// You should have received a copy of the GNU General Public License
// along with Open Ethereum. If not, see <http://www.gnu.org/licenses/>.
extern crate tempdir;
extern crate tempfile;
use std::process::Command;
use tempdir::TempDir;
use tempfile::Builder;
use std::fs::File;
use std::io::Write;
@ -37,7 +37,7 @@ fn cli_cmd() {
.output()
.unwrap();
let dir = TempDir::new("test-vault").unwrap();
let dir = Builder::new().prefix("test-vault").tempdir().unwrap();
let mut passwd = File::create(dir.path().join("test-password")).unwrap();
writeln!(passwd, "password").unwrap();

View File

@ -351,13 +351,13 @@ fn account_filename(account: &SafeAccount) -> String {
#[cfg(test)]
mod test {
extern crate tempdir;
extern crate tempfile;
use std::{env, fs};
use super::{KeyDirectory, RootDiskDirectory, VaultKey};
use account::SafeAccount;
use crypto::publickey::{Random, Generator};
use self::tempdir::TempDir;
use self::tempfile::TempDir;
#[test]
fn should_create_new_account() {
@ -448,7 +448,7 @@ mod test {
#[test]
fn should_list_vaults() {
// given
let temp_path = TempDir::new("").unwrap();
let temp_path = TempDir::new().unwrap();
let directory = RootDiskDirectory::create(&temp_path).unwrap();
let vault_provider = directory.as_vault_provider().unwrap();
vault_provider.create("vault1", VaultKey::new(&"password1".into(), 1)).unwrap();
@ -463,7 +463,7 @@ mod test {
#[test]
fn hash_of_files() {
let temp_path = TempDir::new("").unwrap();
let temp_path = TempDir::new().unwrap();
let directory = RootDiskDirectory::create(&temp_path).unwrap();
let hash = directory.files_hash().expect("Files hash should be calculated ok");

View File

@ -278,14 +278,14 @@ fn read_vault_file<P>(vault_dir_path: P, key: Option<&VaultKey>) -> Result<Strin
#[cfg(test)]
mod test {
extern crate tempdir;
extern crate tempfile;
use std::fs;
use std::io::Write;
use std::path::PathBuf;
use super::VaultKey;
use super::{VAULT_FILE_NAME, check_vault_name, make_vault_dir_path, create_vault_file, read_vault_file, VaultDiskDirectory};
use self::tempdir::TempDir;
use self::tempfile::TempDir;
#[test]
fn check_vault_name_succeeds() {
@ -324,7 +324,7 @@ mod test {
#[test]
fn create_vault_file_succeeds() {
// given
let temp_path = TempDir::new("").unwrap();
let temp_path = TempDir::new().unwrap();
let key = VaultKey::new(&"password".into(), 1024);
let mut vault_dir: PathBuf = temp_path.path().into();
vault_dir.push("vault");
@ -343,7 +343,7 @@ mod test {
#[test]
fn read_vault_file_succeeds() {
// given
let temp_path = TempDir::new("").unwrap();
let temp_path = TempDir::new().unwrap();
let key = VaultKey::new(&"password".into(), 1024);
let vault_file_contents = r#"{"crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"758696c8dc6378ab9b25bb42790da2f5"},"ciphertext":"54eb50683717d41caaeb12ea969f2c159daada5907383f26f327606a37dc7168","kdf":"pbkdf2","kdfparams":{"c":1024,"dklen":32,"prf":"hmac-sha256","salt":"3c320fa566a1a7963ac8df68a19548d27c8f40bf92ef87c84594dcd5bbc402b6"},"mac":"9e5c2314c2a0781962db85611417c614bd6756666b6b1e93840f5b6ed895f003"}}"#;
let dir: PathBuf = temp_path.path().into();
@ -364,7 +364,7 @@ mod test {
#[test]
fn read_vault_file_fails() {
// given
let temp_path = TempDir::new("").unwrap();
let temp_path = TempDir::new().unwrap();
let key = VaultKey::new(&"password1".into(), 1024);
let dir: PathBuf = temp_path.path().into();
let mut vault_file_path: PathBuf = dir.clone();
@ -393,7 +393,7 @@ mod test {
#[test]
fn vault_directory_can_be_created() {
// given
let temp_path = TempDir::new("").unwrap();
let temp_path = TempDir::new().unwrap();
let key = VaultKey::new(&"password".into(), 1024);
let dir: PathBuf = temp_path.path().into();
@ -413,7 +413,7 @@ mod test {
#[test]
fn vault_directory_cannot_be_created_if_already_exists() {
// given
let temp_path = TempDir::new("").unwrap();
let temp_path = TempDir::new().unwrap();
let key = VaultKey::new(&"password".into(), 1024);
let dir: PathBuf = temp_path.path().into();
let mut vault_dir = dir.clone();
@ -430,7 +430,7 @@ mod test {
#[test]
fn vault_directory_cannot_be_opened_if_not_exists() {
// given
let temp_path = TempDir::new("").unwrap();
let temp_path = TempDir::new().unwrap();
let key = VaultKey::new(&"password".into(), 1024);
let dir: PathBuf = temp_path.path().into();

View File

@ -688,13 +688,13 @@ impl SimpleSecretStore for EthMultiStore {
#[cfg(test)]
mod tests {
extern crate tempdir;
extern crate tempfile;
use accounts_dir::{KeyDirectory, MemoryDirectory, RootDiskDirectory};
use crypto::publickey::{Random, Generator, KeyPair};
use secret_store::{SimpleSecretStore, SecretStore, SecretVaultRef, StoreAccountRef, Derivation};
use super::{EthStore, EthMultiStore};
use self::tempdir::TempDir;
use self::tempfile::TempDir;
use ethereum_types::H256;
fn keypair() -> KeyPair {
@ -716,7 +716,7 @@ mod tests {
impl RootDiskDirectoryGuard {
pub fn new() -> Self {
let temp_path = TempDir::new("").unwrap();
let temp_path = TempDir::new().unwrap();
let disk_dir = Box::new(RootDiskDirectory::create(temp_path.path()).unwrap());
RootDiskDirectoryGuard {

View File

@ -28,7 +28,7 @@ extern crate serde_json;
extern crate smallvec;
extern crate time;
extern crate tiny_keccak;
extern crate tempdir;
extern crate tempfile;
extern crate parity_crypto as crypto;
extern crate ethereum_types;

View File

@ -155,12 +155,12 @@ impl<K: hash::Hash + Eq, V> DiskMap<K, V> {
mod tests {
use super::{AddressBook, Address};
use std::collections::HashMap;
use tempdir::TempDir;
use tempfile::TempDir;
use crate::account_data::AccountMeta;
#[test]
fn should_save_and_reload_address_book() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let mut b = AddressBook::new(tempdir.path());
b.set_name(Address::from_low_u64_be(1), "One".to_owned());
b.set_meta(Address::from_low_u64_be(1), "{1:1}".to_owned());
@ -172,7 +172,7 @@ mod tests {
#[test]
fn should_remove_address() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let mut b = AddressBook::new(tempdir.path());
b.set_name(Address::from_low_u64_be(1), "One".to_owned());

View File

@ -20,7 +20,7 @@ criterion = "0.3"
hex-literal = "0.2.1"
rustc-hex = "2.1.0"
serde_json = "1.0"
tempdir = "0.3"
tempfile = "3.1"
[features]
default = []

View File

@ -22,19 +22,19 @@ extern crate hex_literal;
extern crate common_types;
extern crate ethash;
extern crate tempdir;
extern crate tempfile;
use criterion::Criterion;
use ethash::progpow;
use tempdir::TempDir;
use tempfile::TempDir;
use ethash::NodeCacheBuilder;
use ethash::compute::light_compute;
use common_types::engines::OptimizeFor;
fn bench_hashimoto_light(c: &mut Criterion) {
let builder = NodeCacheBuilder::new(OptimizeFor::Memory, u64::max_value());
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let light = builder.light(&tempdir.path(), 1);
let h = hex!("c9149cc0386e689d789a1c2f3d5d169a61a6218ed30e74414dc736e442ef3d1f");
let mut hash = [0; 32];
@ -47,7 +47,7 @@ fn bench_hashimoto_light(c: &mut Criterion) {
fn bench_progpow_light(c: &mut Criterion) {
let builder = NodeCacheBuilder::new(OptimizeFor::Memory, u64::max_value());
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let cache = builder.new_cache(tempdir.into_path(), 0);
let h = hex!("c9149cc0386e689d789a1c2f3d5d169a61a6218ed30e74414dc736e442ef3d1f");
@ -70,7 +70,7 @@ fn bench_progpow_light(c: &mut Criterion) {
fn bench_progpow_optimal_light(c: &mut Criterion) {
let builder = NodeCacheBuilder::new(OptimizeFor::Memory, u64::max_value());
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let cache = builder.new_cache(tempdir.into_path(), 0);
let c_dag = progpow::generate_cdag(cache.as_ref());

View File

@ -329,7 +329,7 @@ pub fn calculate_dag_item(node_index: u32, cache: &[Node]) -> Node {
mod test {
use super::*;
use std::fs;
use tempdir::TempDir;
use tempfile::TempDir;
#[test]
fn test_get_cache_size() {
@ -402,7 +402,7 @@ mod test {
];
let nonce = 0xd7b3ac70a301a249;
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
// difficulty = 0x085657254bd9u64;
let light = NodeCacheBuilder::new(None, u64::max_value()).light(tempdir.path(), 486382);
let result = light_compute(&light, &hash, nonce);
@ -412,7 +412,7 @@ mod test {
#[test]
fn test_drop_old_data() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let builder = NodeCacheBuilder::new(None, u64::max_value());
let first = builder.light(tempdir.path(), 0).to_file().unwrap().to_owned();

View File

@ -37,7 +37,7 @@ extern crate rustc_hex;
extern crate serde_json;
#[cfg(test)]
extern crate tempdir;
extern crate tempfile;
#[cfg(feature = "bench")]
@ -196,9 +196,9 @@ fn difficulty_to_boundary_aux<T: Into<U512>>(difficulty: T) -> ethereum_types::U
#[test]
fn test_lru() {
use tempdir::TempDir;
use tempfile::TempDir;
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let ethash = EthashManager::new(tempdir.path(), None, u64::max_value());
let hash = [0u8; 32];
ethash.compute_light(1, &hash, 1);

View File

@ -420,7 +420,7 @@ pub fn generate_cdag(cache: &[Node]) -> CDag {
#[cfg(test)]
mod test {
use tempdir::TempDir;
use tempfile::TempDir;
use common_types::engines::OptimizeFor;
use cache::NodeCacheBuilder;
@ -440,7 +440,7 @@ mod test {
#[test]
fn test_cdag() {
let builder = NodeCacheBuilder::new(OptimizeFor::Memory, u64::max_value());
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let cache = builder.new_cache(tempdir.into_path(), 0);
let c_dag = generate_cdag(cache.as_ref());
@ -535,7 +535,7 @@ mod test {
#[test]
fn test_progpow_hash() {
let builder = NodeCacheBuilder::new(OptimizeFor::Memory, u64::max_value());
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let cache = builder.new_cache(tempdir.into_path(), 0);
let c_dag = generate_cdag(cache.as_ref());
@ -596,7 +596,7 @@ mod test {
for test in tests {
let builder = NodeCacheBuilder::new(OptimizeFor::Memory, u64::max_value());
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let cache = builder.new_cache(tempdir.path().to_owned(), test.block_number);
let c_dag = generate_cdag(cache.as_ref());

View File

@ -56,7 +56,7 @@ serde_derive = "1.0"
snapshot = { path = "snapshot" }
spec = { path = "spec" }
state-db = { path = "state-db" }
tempdir = { version = "0.3", optional = true }
tempfile = { version = "3.1", optional = true }
trace = { path = "trace" }
trace-time = "0.1"
trie-vm-factories = { path = "trie-vm-factories" }
@ -85,7 +85,7 @@ parity-runtime = "0.1.1"
serde_json = "1.0"
stats = { path = "../util/stats" }
pod = { path = "pod" }
tempdir = "0.3"
tempfile = "3.1"
trie-standardmap = "0.15.0"
[features]
@ -126,7 +126,7 @@ test-helpers = [
"kvdb-memorydb",
"kvdb-rocksdb",
"pod",
"tempdir",
"tempfile",
"basic-authority/test-helpers"
]

View File

@ -31,5 +31,5 @@ triehash-ethereum = { version = "0.2", path = "../../util/triehash-ethereum" }
env_logger = "0.5"
parity-crypto = { version = "0.5.0", features = ["publickey"] }
rustc-hex = "2.1.0"
tempdir = "0.3"
tempfile = "3.1"
kvdb-memorydb = "0.4.0"

View File

@ -1629,7 +1629,7 @@ mod tests {
use parity_crypto::publickey::Secret;
use keccak_hash::keccak;
use rustc_hex::FromHex;
use tempdir::TempDir;
use tempfile::TempDir;
use std::str::FromStr;
struct TestBlockChainDB {
@ -1656,8 +1656,8 @@ mod tests {
/// 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(),

View File

@ -24,7 +24,7 @@ accounts = { package = "ethcore-accounts", path = "../../../accounts" }
engine = { path = "../../engine", features = ["test-helpers"] }
ethcore = { path = "../..", features = ["test-helpers"] }
keccak-hash = "0.4.0"
tempdir = "0.3"
tempfile = "3.1"
spec = { path = "../../spec" }
[features]

View File

@ -230,12 +230,12 @@ mod tests {
header::Header,
engines::{Seal, SealingState}
};
use tempdir::TempDir;
use tempfile::TempDir;
/// Create a new test chain spec with `BasicAuthority` consensus engine.
fn new_test_authority() -> Spec {
let bytes: &[u8] = include_bytes!("../res/basic_authority.json");
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
Spec::load(&tempdir.path(), bytes).expect("invalid chain spec")
}

View File

@ -23,4 +23,4 @@ ethcore = { path = "../..", features = ["test-helpers"] }
keccak-hash = "0.4.0"
rlp = "0.4.2"
spec = { path = "../../spec" }
tempdir = "0.3"
tempfile = "3.1"

View File

@ -525,12 +525,12 @@ mod tests {
};
use rlp;
use spec::{new_ropsten, new_mcip3_test, new_homestead_test_machine, Spec};
use tempdir::TempDir;
use tempfile::TempDir;
use super::{Ethash, EthashParams, ecip1017_eras_block_reward};
fn test_spec() -> Spec {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
new_ropsten(&tempdir.path())
}
@ -799,7 +799,7 @@ mod tests {
fn difficulty_frontier() {
let machine = new_homestead_test_machine();
let ethparams = get_default_ethash_params();
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let ethash = Ethash::new(tempdir.path(), ethparams, machine, None);
let mut parent_header = Header::default();
@ -818,7 +818,7 @@ mod tests {
fn difficulty_homestead() {
let machine = new_homestead_test_machine();
let ethparams = get_default_ethash_params();
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let ethash = Ethash::new(tempdir.path(), ethparams, machine, None);
let mut parent_header = Header::default();
@ -840,7 +840,7 @@ mod tests {
ecip1010_pause_transition: 3000000,
..get_default_ethash_params()
};
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let ethash = Ethash::new(tempdir.path(), ethparams, machine, None);
let mut parent_header = Header::default();
@ -875,7 +875,7 @@ mod tests {
ecip1010_continue_transition: 5000000,
..get_default_ethash_params()
};
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let ethash = Ethash::new(tempdir.path(), ethparams, machine, None);
let mut parent_header = Header::default();
@ -922,7 +922,7 @@ mod tests {
fn difficulty_max_timestamp() {
let machine = new_homestead_test_machine();
let ethparams = get_default_ethash_params();
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let ethash = Ethash::new(tempdir.path(), ethparams, machine, None);
let mut parent_header = Header::default();
@ -941,7 +941,7 @@ mod tests {
fn test_extra_info() {
let machine = new_homestead_test_machine();
let ethparams = get_default_ethash_params();
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let ethash = Ethash::new(tempdir.path(), ethparams, machine, None);
let mut header = Header::default();
header.set_seal(vec![rlp::encode(&H256::from_str("b251bd2e0283d0658f2cadfdc8ca619b5de94eca5742725e2e757dd13ed7503d").unwrap()), rlp::encode(&H64::zero())]);

View File

@ -41,4 +41,4 @@ criterion = "0.3.1"
ethcore-db = { path = "../db" }
journaldb = { path = "../../util/journaldb" }
state-db = { path = "../state-db" }
tempdir = "0.3.7"
tempfile = "3.1"

View File

@ -35,10 +35,10 @@ use ethereum_types::U256;
use executive_state::ExecutiveState;
use spec::{new_constantinople_test_machine, new_istanbul_test_machine};
use state_db::StateDB;
use tempdir::TempDir;
use tempfile::Builder;
fn build_state() -> State<StateDB> {
let db_path = TempDir::new("execution-bench").unwrap();
let db_path = Builder::new().prefix("execution-bench").tempdir().unwrap();
let db = new_temp_db(&db_path.path());
let journal_db = journaldb::new(db.key_value().clone(), journaldb::Algorithm::OverlayRecent, db::COL_STATE);
let state_db = StateDB::new(journal_db, 25 * 1024 * 1024);

View File

@ -51,7 +51,7 @@ verification = { path = "../verification" }
[dev-dependencies]
ethcore = { path = "..", features = ["test-helpers"] }
kvdb-memorydb = "0.4.0"
tempdir = "0.3"
tempfile = "3.1"
[features]
default = []

View File

@ -98,5 +98,5 @@ extern crate ethcore;
#[cfg(test)]
extern crate kvdb_memorydb;
#[cfg(test)]
extern crate tempdir;
extern crate tempfile;
extern crate journaldb;

View File

@ -264,7 +264,7 @@ mod tests {
#[test]
fn file_store() {
let tempdir = ::tempdir::TempDir::new("").unwrap();
let tempdir = ::tempfile::TempDir::new().unwrap();
let path = tempdir.path().join("file");
let store = FileStore(path);

View File

@ -46,7 +46,7 @@ ethjson = { path = "../../json" }
parity-crypto = { version = "0.5.0", features = ["publickey"] }
hex-literal = "0.2.1"
spec = { path = "../spec" }
tempdir = "0.3"
tempfile = "3.1"
trace = { path = "../trace" }
[features]

View File

@ -165,7 +165,7 @@ mod test {
use std::sync::Arc;
use std::str::FromStr;
use tempdir::TempDir;
use tempfile::TempDir;
use ethereum_types::{U256, Address};
use client_traits::BlockChainClient;
@ -190,7 +190,7 @@ mod test {
let spec_data = include_str!("../../res/tx_permission_tests/contract_ver_2_genesis.json");
let db = test_helpers::new_db();
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let spec = Spec::load(&tempdir.path(), spec_data.as_bytes()).unwrap();
let client = Client::new(
@ -269,7 +269,7 @@ mod test {
let spec_data = include_str!("../../res/tx_permission_tests/contract_ver_3_genesis.json");
let db = test_helpers::new_db();
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let spec = Spec::load(&tempdir.path(), spec_data.as_bytes()).unwrap();
let client = Client::new(
@ -311,7 +311,7 @@ mod test {
let spec_data = include_str!("../../res/tx_permission_tests/deprecated_contract_genesis.json");
let db = test_helpers::new_db();
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let spec = Spec::load(&tempdir.path(), spec_data.as_bytes()).unwrap();
let client = Client::new(

View File

@ -25,4 +25,4 @@ ethcore = { path = "..", features = ["test-helpers"] }
kvdb-memorydb = "0.4.0"
ethcore-io = { path = "../../util/io" }
spec = { path = "../spec" }
tempdir = "0.3"
tempfile = "3.1"

View File

@ -33,7 +33,7 @@ extern crate ethcore_io as io;
#[cfg(test)]
extern crate kvdb_memorydb;
#[cfg(test)]
extern crate tempdir;
extern crate tempfile;
#[cfg(test)]
extern crate spec;
#[macro_use]
@ -141,7 +141,7 @@ mod test {
use network::{ConnectionDirection, ConnectionFilter, NodeId};
use io::IoChannel;
use super::NodeFilter;
use tempdir::TempDir;
use tempfile::TempDir;
use ethereum_types::Address;
use std::str::FromStr;
@ -150,7 +150,7 @@ mod test {
fn node_filter() {
let contract_addr = Address::from_str("0000000000000000000000000000000000000005").unwrap();
let data = include_bytes!("../res/node_filter.json");
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let spec = Spec::load(&tempdir.path(), &data[..]).unwrap();
let client_db = test_helpers::new_db();

View File

@ -24,4 +24,4 @@ trace-time = "0.1"
ethcore = { path = "..", features = ["test-helpers"] }
ethcore-db = { path = "../db" }
kvdb-rocksdb = "0.6.0"
tempdir = "0.3"
tempfile = "3.1"

View File

@ -35,7 +35,7 @@ extern crate trace_time;
#[cfg(test)]
extern crate ethcore_db;
#[cfg(test)]
extern crate tempdir;
extern crate tempfile;
mod service;

View File

@ -297,7 +297,7 @@ mod tests {
use std::sync::Arc;
use std::{time, thread};
use tempdir::TempDir;
use tempfile::TempDir;
use ethcore_db::NUM_COLUMNS;
use ethcore::client::ClientConfig;
@ -311,7 +311,7 @@ mod tests {
#[test]
fn it_can_be_started() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let client_path = tempdir.path().join("client");
let snapshot_path = tempdir.path().join("snapshot");

View File

@ -56,7 +56,7 @@ ethkey = { path = "../../accounts/ethkey" }
kvdb-rocksdb = "0.6.0"
lazy_static = { version = "1.3" }
spec = { path = "../spec" }
tempdir = "0.3"
tempfile = "3.1"
trie-standardmap = "0.15.0"
# Note[dvdplm]: Ensure the snapshot tests are included in the dependency tree, which in turn means that
# `cargo test --all` runs the tests.

View File

@ -28,12 +28,12 @@ use ethcore::test_helpers::new_temp_db;
use ethereum_types::H256;
use parking_lot::RwLock;
use snapshot::test_helpers::to_fat_rlps;
use tempdir::TempDir;
use tempfile::TempDir;
use ethtrie::TrieDB;
use trie_db::Trie;
fn fat_rlps(c: &mut Criterion) {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let blockchain_db = new_temp_db(tempdir.path());
let mut state_rebuilder = snapshot::StateRebuilder::new(blockchain_db.key_value().clone(), journaldb::Algorithm::OverlayRecent);

View File

@ -34,7 +34,7 @@ rlp = "0.4.2"
snappy = { package = "parity-snappy", version ="0.1.0" }
snapshot = { path = "../../snapshot", features = ["test-helpers"] }
spec = { path = "../../spec" }
tempdir = "0.3"
tempfile = "3.1"
trie-db = "0.20.0"
trie-standardmap = "0.15.0"
ethabi = "9.0.1"

View File

@ -49,7 +49,7 @@ use snapshot::{
io::{SnapshotReader, PackedWriter, PackedReader},
chunker,
};
use tempdir::TempDir;
use tempfile::TempDir;
use trie_db::{TrieMut, Trie};
use trie_standardmap::{Alphabet, StandardMap, ValueMode};
@ -144,7 +144,7 @@ pub fn fill_storage(mut db: AccountDBMut, root: &mut H256, seed: &mut H256) {
/// Take a snapshot from the given client into a temporary file.
/// Return a snapshot reader for it.
pub fn snap(client: &Client) -> (Box<dyn SnapshotReader>, TempDir) {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let path = tempdir.path().join("file");
let writer = PackedWriter::new(&path).unwrap();
let progress = RwLock::new(Progress::new());

View File

@ -16,7 +16,7 @@
//! Tests for snapshot i/o.
use tempdir::TempDir;
use tempfile::TempDir;
use keccak_hash::keccak;
use common_types::snapshot::ManifestData;
@ -31,7 +31,7 @@ const BLOCK_CHUNKS: &'static [&'static [u8]] = &[b"hello!", b"goodbye!", b"abcde
#[test]
fn packed_write_and_read() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let path = tempdir.path().join("packed");
let mut writer = PackedWriter::new(&path).unwrap();
@ -71,7 +71,7 @@ fn packed_write_and_read() {
#[test]
fn loose_write_and_read() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let mut writer = LooseWriter::new(tempdir.path().into()).unwrap();
let mut state_hashes = Vec::new();

View File

@ -35,7 +35,7 @@ use keccak_hash::keccak;
use lazy_static::lazy_static;
use log::trace;
use spec::Spec;
use tempdir::TempDir;
use tempfile::TempDir;
use crate::helpers as snapshot_helpers;
@ -66,7 +66,7 @@ lazy_static! {
/// `test_validator_set::ValidatorSet` provides a native wrapper for the ABi.
fn spec_fixed_to_contract() -> Spec {
let data = include_bytes!("test_validator_contract.json");
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
Spec::load(&tempdir.path(), &data[..]).unwrap()
}

View File

@ -17,7 +17,7 @@
//! PoW block chunker and rebuilder tests.
use std::sync::atomic::AtomicBool;
use tempdir::TempDir;
use tempfile::TempDir;
use common_types::{
errors::{EthcoreError as Error, SnapshotError},
engines::ForkChoice,
@ -47,7 +47,7 @@ fn chunk_and_restore(amount: u64) {
let genesis = genesis.last();
let engine = spec::new_test().engine;
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let snapshot_path = tempdir.path().join("SNAP");
let old_db = test_helpers::new_db();

View File

@ -19,7 +19,7 @@
use std::fs;
use std::sync::Arc;
use tempdir::TempDir;
use tempfile::TempDir;
use blockchain::BlockProvider;
use ethcore::client::{Client, ClientConfig};
use client_traits::{BlockInfo, ImportBlock};
@ -54,7 +54,7 @@ fn sends_async_messages() {
let service = IoService::<ClientIoMessage<Client>>::start().unwrap();
let spec = spec::new_test();
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let dir = tempdir.path().join("snapshot");
let snapshot_params = ServiceParams {
@ -94,7 +94,7 @@ fn cannot_finish_with_invalid_chunks() {
use kvdb_rocksdb::DatabaseConfig;
let spec = spec::new_test();
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let state_hashes: Vec<_> = (0..5).map(|_| H256::random()).collect();
let block_hashes: Vec<_> = (0..5).map(|_| H256::random()).collect();
@ -145,7 +145,7 @@ fn restored_is_equivalent() {
let gas_prices = vec![1.into(), 2.into(), 3.into(), 999.into()];
let client = generate_dummy_client_with_spec_and_data(spec::new_null, NUM_BLOCKS, TX_PER, &gas_prices, false);
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let client_db = tempdir.path().join("client_db");
let path = tempdir.path().join("snapshot");
@ -210,7 +210,7 @@ fn guards_delete_folders() {
let client = generate_dummy_client_with_spec_and_data(spec::new_null, 400, 5, &gas_prices, false);
let spec = spec::new_null();
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let service_params = ServiceParams {
engine: spec.engine.clone(),
genesis_block: spec.genesis_block(),
@ -259,7 +259,7 @@ fn keep_ancient_blocks() {
const SNAPSHOT_MODE: PowSnapshot = PowSnapshot { blocks: NUM_SNAPSHOT_BLOCKS, max_restore_blocks: NUM_SNAPSHOT_BLOCKS };
// Temporary folders
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let snapshot_path = tempdir.path().join("SNAP");
// Generate blocks
@ -377,7 +377,7 @@ fn recover_aborted_recovery() {
let client = generate_dummy_client_with_spec_and_data(spec::new_null, NUM_BLOCKS, 5, &gas_prices, false);
let spec = spec::new_null();
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let db_config = DatabaseConfig::with_columns(ethcore_db::NUM_COLUMNS);
let client_db = new_db();
let client2 = Client::new(

View File

@ -36,7 +36,7 @@ use ethereum_types::H256;
use journaldb::{self, Algorithm};
use kvdb_rocksdb::{Database, DatabaseConfig};
use parking_lot::{Mutex, RwLock};
use tempdir::TempDir;
use tempfile::TempDir;
use crate::helpers::StateProducer;
@ -54,7 +54,7 @@ fn snap_and_restore() {
producer.tick(&mut rng, &mut old_db);
}
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let snap_file = tempdir.path().join("SNAP");
let state_root = producer.state_root();
@ -152,7 +152,7 @@ fn get_code_from_prev_chunk() {
let chunk1 = make_chunk(acc.clone(), h1);
let chunk2 = make_chunk(acc, h2);
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let db_cfg = DatabaseConfig::with_columns(ethcore_db::NUM_COLUMNS);
let new_db = Arc::new(Database::open(&db_cfg, tempdir.path().to_str().unwrap()).unwrap());
@ -181,7 +181,7 @@ fn checks_flag() {
producer.tick(&mut rng, &mut old_db);
}
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let snap_file = tempdir.path().join("SNAP");
let state_root = producer.state_root();
@ -199,7 +199,7 @@ fn checks_flag() {
block_hash: H256::zero(),
}).unwrap();
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let db_path = tempdir.path().join("db");
{
let new_db = Arc::new(Database::open(&db_cfg, &db_path.to_string_lossy()).unwrap());

View File

@ -39,4 +39,4 @@ vm = { path = "../vm" }
[dev-dependencies]
ethcore = { path = "..", features = ["test-helpers"] }
env_logger = "0.5"
tempdir = "0.3.7"
tempfile = "3.1"

View File

@ -129,14 +129,14 @@ mod tests {
use account_state::State;
use common_types::{view, views::BlockView};
use ethereum_types::U256;
use tempdir::TempDir;
use tempfile::TempDir;
use ethcore::test_helpers::get_temp_state_db;
use super::{new_ropsten, new_foundation};
#[test]
fn ensure_db_good() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let spec = new_ropsten(&tempdir.path());
let engine = &spec.engine;
let genesis_header = spec.genesis_header();
@ -152,7 +152,7 @@ mod tests {
#[test]
fn ropsten() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let ropsten = new_ropsten(&tempdir.path());
assert_eq!(ropsten.state_root, "217b0bbcfb72e2d57e28f33cb361b9983513177755dc3f33ce3e7022ed62b77b".parse().unwrap());
@ -162,7 +162,7 @@ mod tests {
#[test]
fn frontier() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let frontier = new_foundation(&tempdir.path());
assert_eq!(frontier.state_root, "d7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544".parse().unwrap());

View File

@ -638,13 +638,13 @@ mod tests {
use common_types::{view, views::BlockView};
use ethereum_types::{Address, H256};
use ethcore::test_helpers::get_temp_state_db;
use tempdir::TempDir;
use tempfile::TempDir;
use super::Spec;
#[test]
fn test_load_empty() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
assert!(Spec::load(&tempdir.path(), &[] as &[u8]).is_err());
}

View File

@ -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)
}

View File

@ -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;

View File

@ -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);

View File

@ -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(

View File

@ -42,7 +42,7 @@ spec = { path = "../spec" }
# Benches
ethash = { package = "ethash-engine", path = "../engines/ethash" }
tempdir = "0.3.7"
tempfile = "3.1"
[features]
# Used to selectively expose code for benchmarks.

View File

@ -24,7 +24,7 @@ use ethash::{EthashParams, Ethash};
use ethereum_types::U256;
use ethcore::test_helpers::TestBlockChainClient;
use spec::new_constantinople_test_machine;
use tempdir::TempDir;
use tempfile::TempDir;
use ::verification::{
FullFamilyParams,
@ -72,7 +72,7 @@ fn ethash_params() -> EthashParams {
fn build_ethash() -> Ethash {
let machine = new_constantinople_test_machine();
let ethash_params = ethash_params();
let cache_dir = TempDir::new("").unwrap();
let cache_dir = TempDir::new().unwrap();
Ethash::new(
cache_dir.path(),
ethash_params,

View File

@ -31,7 +31,7 @@ vm = { path = "../ethcore/vm" }
[dev-dependencies]
criterion = "0.3"
hex-literal = "0.2.1"
tempdir = "0.3"
tempfile = "3.1"
[features]
evm-debug = ["ethcore/evm-debug-tests"]

View File

@ -239,7 +239,7 @@ pub mod tests {
use std::sync::Arc;
use rustc_hex::FromHex;
use super::*;
use tempdir::TempDir;
use tempfile::TempDir;
use ethereum_types::Address;
use spec::{self, Spec};
@ -258,7 +258,7 @@ pub mod tests {
params.code = Some(Arc::new(code.from_hex().unwrap()));
params.gas = gas.into();
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let spec = spec::new_foundation(&tempdir.path());
let result = run_action(&spec, params, informant, TrieSpec::Secure);
match result {
@ -280,7 +280,7 @@ pub mod tests {
params.code_address = Address::from_low_u64_be(0x20);
params.gas = 0xffff.into();
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let spec = Spec::load(&tempdir.path(), include_bytes!("../res/testchain.json") as &[u8]).unwrap();
let _result = run_action(&spec, params, inf, TrieSpec::Secure);

View File

@ -1171,7 +1171,7 @@ mod tests {
use std::fs::File;
use std::str::FromStr;
use tempdir::TempDir;
use tempfile::TempDir;
use ethcore::miner::MinerOptions;
use miner::pool::PrioritizationStrategy;
use parity_rpc::NetworkSettings;
@ -1620,7 +1620,7 @@ mod tests {
#[test]
fn should_not_bail_on_empty_line_in_reserved_peers() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let filename = tempdir.path().join("peers");
File::create(&filename).unwrap().write_all(b" \n\t\n").unwrap();
let args = vec!["parity", "--reserved-peers", filename.to_str().unwrap()];
@ -1630,7 +1630,7 @@ mod tests {
#[test]
fn should_ignore_comments_in_reserved_peers() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let filename = tempdir.path().join("peers_comments");
File::create(&filename).unwrap().write_all(b"# Sample comment\nenode://6f8a80d14311c39f35f516fa664deaaaa13e85b2f7493f37f6144d86991ec012937307647bd3b9a82abe2974e1407241d54947bbb39763a4cac9f77166ad92a0@172.0.0.1:30303\n").unwrap();
let args = vec!["parity", "--reserved-peers", filename.to_str().unwrap()];

View File

@ -19,7 +19,7 @@ extern crate migration_rocksdb;
extern crate ethcore_blockchain;
#[cfg(test)]
extern crate tempdir;
extern crate tempfile;
use std::{io, fs};
use std::sync::Arc;

View File

@ -350,7 +350,7 @@ mod tests {
use std::fs::File;
use std::io::Write;
use std::collections::HashSet;
use tempdir::TempDir;
use tempfile::TempDir;
use ethereum_types::U256;
use ethcore::miner::PendingSet;
use ethkey::Password;
@ -445,7 +445,7 @@ mod tests {
#[test]
fn test_password() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let path = tempdir.path().join("file");
let mut file = File::create(&path).unwrap();
file.write_all(b"a bc ").unwrap();
@ -454,7 +454,7 @@ mod tests {
#[test]
fn test_password_multiline() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let path = tempdir.path().join("file");
let mut file = File::create(path.as_path()).unwrap();
file.write_all(br#" password with trailing whitespace

View File

@ -96,7 +96,7 @@ extern crate ethcore_call_contract as call_contract;
extern crate pretty_assertions;
#[cfg(test)]
extern crate tempdir;
extern crate tempfile;
mod account;
mod account_utils;

View File

@ -20,7 +20,7 @@ serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
parking_lot = "0.10.0"
tempdir = "0.3"
tempfile = "3.1"
tiny-keccak = "1.4"
tokio-timer = "0.1"
transient-hashmap = "0.4"

View File

@ -215,7 +215,7 @@ mod tests {
use std::io::{Read, Write};
use std::{time, fs};
use std::cell::Cell;
use tempdir::TempDir;
use tempfile::TempDir;
use hash::keccak;
use ethereum_types::H256;
@ -289,7 +289,7 @@ mod tests {
#[test]
fn should_read_old_format_from_file() {
// given
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let file_path = tempdir.path().join("file");
let code = "23521352asdfasdfadf";
{
@ -308,7 +308,7 @@ mod tests {
#[test]
fn should_remove_old_unused_tokens() {
// given
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let file_path = tempdir.path().join("file");
let code1 = "11111111asdfasdf111";
let code2 = "22222222asdfasdf222";

View File

@ -86,7 +86,7 @@ extern crate account_state;
extern crate stats;
extern crate snapshot;
extern crate tempdir;
extern crate tempfile;
extern crate trace;
extern crate vm;

View File

@ -16,7 +16,7 @@
use std::ops::{Deref, DerefMut};
use std::path::PathBuf;
use tempdir::TempDir;
use tempfile::TempDir;
use parity_runtime::{Runtime, TaskExecutor};
@ -62,7 +62,7 @@ pub struct GuardedAuthCodes {
impl Default for GuardedAuthCodes {
fn default() -> Self {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let path = tempdir.path().join("file");
GuardedAuthCodes {

View File

@ -21,7 +21,7 @@ use accounts::{AccountProvider, AccountProviderSettings};
use ethereum_types::Address;
use ethstore::EthStore;
use ethstore::accounts_dir::RootDiskDirectory;
use tempdir::TempDir;
use tempfile::TempDir;
use jsonrpc_core::IoHandler;
use v1::{ParityAccounts, ParityAccountsInfo, ParityAccountsClient};
@ -219,7 +219,7 @@ fn should_be_able_to_remove_address() {
#[test]
fn rpc_parity_new_vault() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let tester = setup_with_vaults_support(tempdir.path().to_str().unwrap());
let request = r#"{"jsonrpc": "2.0", "method": "parity_newVault", "params":["vault1", "password1"], "id": 1}"#;
@ -232,7 +232,7 @@ fn rpc_parity_new_vault() {
#[test]
fn rpc_parity_open_vault() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let tester = setup_with_vaults_support(tempdir.path().to_str().unwrap());
assert!(tester.accounts.create_vault("vault1", &"password1".into()).is_ok());
@ -246,7 +246,7 @@ fn rpc_parity_open_vault() {
#[test]
fn rpc_parity_close_vault() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let tester = setup_with_vaults_support(tempdir.path().to_str().unwrap());
assert!(tester.accounts.create_vault("vault1", &"password1".into()).is_ok());
@ -259,7 +259,7 @@ fn rpc_parity_close_vault() {
#[test]
fn rpc_parity_change_vault_password() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let tester = setup_with_vaults_support(tempdir.path().to_str().unwrap());
assert!(tester.accounts.create_vault("vault1", &"password1".into()).is_ok());
@ -272,7 +272,7 @@ fn rpc_parity_change_vault_password() {
#[test]
fn rpc_parity_change_vault() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let tester = setup_with_vaults_support(tempdir.path().to_str().unwrap());
let (address, _) = tester.accounts.new_account_and_public(&"root_password".into()).unwrap();
@ -286,7 +286,7 @@ fn rpc_parity_change_vault() {
#[test]
fn rpc_parity_vault_adds_vault_field_to_acount_meta() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let tester = setup_with_vaults_support(tempdir.path().to_str().unwrap());
let (address1, _) = tester.accounts.new_account_and_public(&"root_password1".into()).unwrap();
@ -310,7 +310,7 @@ fn rpc_parity_vault_adds_vault_field_to_acount_meta() {
#[test]
fn rpc_parity_list_vaults() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let tester = setup_with_vaults_support(tempdir.path().to_str().unwrap());
assert!(tester.accounts.create_vault("vault1", &"password1".into()).is_ok());
@ -327,7 +327,7 @@ fn rpc_parity_list_vaults() {
#[test]
fn rpc_parity_list_opened_vaults() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let tester = setup_with_vaults_support(tempdir.path().to_str().unwrap());
assert!(tester.accounts.create_vault("vault1", &"password1".into()).is_ok());
@ -346,7 +346,7 @@ fn rpc_parity_list_opened_vaults() {
#[test]
fn rpc_parity_get_set_vault_meta() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let tester = setup_with_vaults_support(tempdir.path().to_str().unwrap());
assert!(tester.accounts.create_vault("vault1", &"password1".into()).is_ok());

View File

@ -28,7 +28,7 @@ target_info = "0.1"
[dev-dependencies]
ethcore = { path = "../ethcore", features = ["test-helpers"] }
tempdir = "0.3"
tempfile = "3.1"
matches = "0.1"
[features]

View File

@ -43,7 +43,7 @@ extern crate lazy_static;
extern crate log;
#[cfg(test)]
extern crate tempdir;
extern crate tempfile;
#[cfg(test)]
#[macro_use]

View File

@ -724,7 +724,7 @@ pub mod tests {
use std::io::Read;
use std::sync::Arc;
use semver::Version;
use tempdir::TempDir;
use tempfile::TempDir;
use ethcore::test_helpers::{TestBlockChainClient, EachBlockWith};
use self::fetch::Error;
use super::*;
@ -865,7 +865,7 @@ pub mod tests {
}
fn update_policy() -> (UpdatePolicy, TempDir) {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let update_policy = UpdatePolicy {
path: tempdir.path().into(),

View File

@ -11,7 +11,7 @@ parking_lot = "0.10.0"
[dev-dependencies]
criterion = "0.3"
tempdir = "0.3"
tempfile = "3.1"
[[bench]]
name = "blooms"

View File

@ -16,13 +16,13 @@
#[macro_use]
extern crate criterion;
extern crate tempdir;
extern crate tempfile;
extern crate blooms_db;
extern crate ethbloom;
use std::iter;
use criterion::Criterion;
use tempdir::TempDir;
use tempfile::TempDir;
use blooms_db::Database;
use ethbloom::Bloom;
@ -35,7 +35,7 @@ criterion_group!(
criterion_main!(blooms);
fn bench_blooms_filter_1_million_ok(c: &mut Criterion) {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let database = Database::open(tempdir.path()).unwrap();
database.insert_blooms(999_999, iter::once(&Bloom::zero())).unwrap();
let bloom = Bloom::from_low_u64_be(0x001);
@ -53,7 +53,7 @@ fn bench_blooms_filter_1_million_ok(c: &mut Criterion) {
}
fn bench_blooms_filter_1_million_miss(c: &mut Criterion) {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let database = Database::open(tempdir.path()).unwrap();
database.insert_blooms(999_999, iter::once(&Bloom::zero())).unwrap();
let bloom = Bloom::from_low_u64_be(0x001);
@ -72,7 +72,7 @@ fn bench_blooms_filter_1_million_miss(c: &mut Criterion) {
}
fn bench_blooms_filter_1_million_miss_and_ok(c: &mut Criterion) {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let database = Database::open(tempdir.path()).unwrap();
database.insert_blooms(999_999, iter::once(&Bloom::zero())).unwrap();
let bloom = Bloom::from_low_u64_be(0x001);

View File

@ -294,12 +294,12 @@ where ethbloom::BloomRef<'b>: From<B>, 'b: 'a, II: IntoIterator<Item = B, IntoIt
#[cfg(test)]
mod tests {
use ethbloom::Bloom;
use tempdir::TempDir;
use tempfile::TempDir;
use super::Database;
#[test]
fn test_database() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let mut database = Database::open(tempdir.path()).unwrap();
database.insert_blooms(0, vec![
Bloom::from_low_u64_be(0),
@ -332,7 +332,7 @@ mod tests {
#[test]
fn test_database2() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let mut database = Database::open(tempdir.path()).unwrap();
database.insert_blooms(254, vec![
Bloom::from_low_u64_be(0x100),
@ -362,7 +362,7 @@ mod tests {
#[test]
fn test_db_close() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let blooms = vec![
Bloom::from_low_u64_be(0x100),
Bloom::from_low_u64_be(0x01),

View File

@ -138,12 +138,12 @@ impl<'a> Iterator for FileIterator<'a> {
#[cfg(test)]
mod tests {
use ethbloom::Bloom;
use tempdir::TempDir;
use tempfile::TempDir;
use super::File;
#[test]
fn test_file() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let mut file = File::open(tempdir.path().join("file")).unwrap();
file.accrue_bloom(0, &Bloom::from_low_u64_be(1)).unwrap();
file.flush().unwrap();

View File

@ -11,5 +11,5 @@ kvdb = "0.4.0"
kvdb-rocksdb = "0.6.0"
[dev-dependencies]
tempdir = "0.3"
tempfile = "3.1"
maplit = "1.0.2"

View File

@ -26,7 +26,7 @@ use std::sync::Arc;
use kvdb_rocksdb::{Database, DatabaseConfig};
use maplit::btreemap;
use migration_rocksdb::{Batch, Config, SimpleMigration, Migration, Manager, ChangeColumns};
use tempdir::TempDir;
use tempfile::TempDir;
#[inline]
fn db_path(path: &Path) -> PathBuf {
@ -107,7 +107,7 @@ impl Migration for AddsColumn {
#[test]
fn one_simple_migration() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let db_path = db_path(tempdir.path());
let mut manager = Manager::new(Config::default());
make_db(&db_path, btreemap![vec![] => vec![], vec![1] => vec![1]]);
@ -122,7 +122,7 @@ fn one_simple_migration() {
#[test]
#[should_panic]
fn no_migration_needed() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let db_path = db_path(tempdir.path());
let mut manager = Manager::new(Config::default());
make_db(&db_path, btreemap![vec![] => vec![], vec![1] => vec![1]]);
@ -134,7 +134,7 @@ fn no_migration_needed() {
#[test]
#[should_panic]
fn wrong_adding_order() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let db_path = db_path(tempdir.path());
let mut manager = Manager::new(Config::default());
make_db(&db_path, btreemap![vec![] => vec![], vec![1] => vec![1]]);
@ -145,7 +145,7 @@ fn wrong_adding_order() {
#[test]
fn multiple_migrations() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let db_path = db_path(tempdir.path());
let mut manager = Manager::new(Config::default());
make_db(&db_path, btreemap![vec![] => vec![], vec![1] => vec![1]]);
@ -160,7 +160,7 @@ fn multiple_migrations() {
#[test]
fn second_migration() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let db_path = db_path(tempdir.path());
let mut manager = Manager::new(Config::default());
make_db(&db_path, btreemap![vec![] => vec![], vec![1] => vec![1]]);
@ -175,7 +175,7 @@ fn second_migration() {
#[test]
fn first_and_noop_migration() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let db_path = db_path(tempdir.path());
let mut manager = Manager::new(Config::default());
make_db(&db_path, btreemap![vec![] => vec![], vec![1] => vec![1]]);
@ -189,7 +189,7 @@ fn first_and_noop_migration() {
#[test]
fn noop_and_second_migration() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let db_path = db_path(tempdir.path());
let mut manager = Manager::new(Config::default());
make_db(&db_path, btreemap![vec![] => vec![], vec![1] => vec![1]]);
@ -217,7 +217,7 @@ fn pre_columns() {
let mut manager = Manager::new(Config::default());
manager.add_migration(AddsColumn).unwrap();
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let db_path = db_path(tempdir.path());
// this shouldn't fail to open the database even though it's one column
@ -236,7 +236,7 @@ fn change_columns() {
version: 1,
}).unwrap();
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let db_path = db_path(tempdir.path());
let new_path = manager.execute(&db_path, 0).unwrap();

View File

@ -37,7 +37,7 @@ tiny-keccak = "1.4"
assert_matches = "1.2"
env_logger = "0.5"
hex-literal = "0.2.1"
tempdir = "0.3"
tempfile = "3.1"
[features]
default = []

View File

@ -1270,9 +1270,9 @@ fn load_key(path: &Path) -> Option<Secret> {
#[test]
fn key_save_load() {
use tempdir::TempDir;
use tempfile::TempDir;
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let key = H256::random().into();
save_key(tempdir.path(), &key);
let r = load_key(tempdir.path());

View File

@ -616,7 +616,7 @@ mod tests {
use ethereum_types::H512;
use ipnetwork::IpNetwork;
use tempdir::TempDir;
use tempfile::TempDir;
use assert_matches::assert_matches;
@ -782,7 +782,7 @@ mod tests {
#[test]
fn table_save_load() {
let tempdir = TempDir::new("").unwrap();
let tempdir = TempDir::new().unwrap();
let node1 = Node::from_str("enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@22.99.55.44:7770").unwrap();
let node2 = Node::from_str("enode://b979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@22.99.55.44:7770").unwrap();
let node3 = Node::from_str("enode://c979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@22.99.55.44:7770").unwrap();