Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace tempdir dependency with tempfile #883

Merged
merged 5 commits into from
Jun 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .changelog/unreleased/improvements/851-tempdir.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* `[tendermint-light-client]` Replaced `tempdir` dev dependency (deprecated)
with `tempfile`
([#851](https://github.com/informalsystems/tendermint-rs/issues/851))

2 changes: 1 addition & 1 deletion light-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ tendermint-testgen = { path = "../testgen" }
serde_json = "1.0.51"
gumdrop = "0.8.0"
rand = "0.7.3"
tempdir = "0.3.7"
tempfile = "3.2.0"
proptest = "0.10.1"
4 changes: 2 additions & 2 deletions light-client/src/store/sled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl LightStore for SledStore {
#[cfg(test)]
mod tests {
use super::*;
use tempdir::TempDir;
use tempfile::tempdir;
use tendermint_testgen::{light_block::TmLightBlock as TGLightBlock, Generator, LightChain};

#[test]
Expand Down Expand Up @@ -124,7 +124,7 @@ mod tests {
}

fn with_blocks(height: u64, f: impl FnOnce(SledStore, Vec<LightBlock>)) {
let tmp_dir = TempDir::new("tendermint_light_client_sled_test").unwrap();
let tmp_dir = tempdir().unwrap();
let db = SledStore::open(tmp_dir).unwrap();

let chain = LightChain::default_with_length(height);
Expand Down
6 changes: 3 additions & 3 deletions light-client/src/store/sled/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ where
#[cfg(test)]
mod tests {
use super::*;
use tempdir::TempDir;
use tempfile::tempdir;

#[test]
fn iter_next_returns_lowest_height() {
let tmp_dir = TempDir::new("tendermint_light_client_sled_utils_test").unwrap();
let tmp_dir = tempdir().unwrap();
let db = sled::open(tmp_dir).unwrap();
let kv = HeightIndexedDb::new(db.open_tree("light_store/verified").unwrap());

Expand All @@ -126,7 +126,7 @@ mod tests {

#[test]
fn iter_next_back_returns_highest_height() {
let tmp_dir = TempDir::new("tendermint_light_client_sled_utils_test").unwrap();
let tmp_dir = tempdir().unwrap();
let db = sled::open(tmp_dir).unwrap();
let kv = HeightIndexedDb::new(db.open_tree("light_store/verified").unwrap());

Expand Down
2 changes: 1 addition & 1 deletion tools/proto-compiler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ publish = false
walkdir = { version = "2.3" }
prost-build = { version = "0.7" }
git2 = { version = "0.13" }
tempdir = { version = "0.3" }
tempfile = { version = "3.2.0" }
subtle-encoding = { version = "0.5" }
4 changes: 2 additions & 2 deletions tools/proto-compiler/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::env::var;
use std::path::PathBuf;
use tempdir::TempDir;
use tempfile::tempdir;

mod functions;
use functions::{copy_files, find_proto_files, generate_tendermint_lib, get_commitish};
Expand All @@ -26,7 +26,7 @@ fn main() {
.join("prost");
let out_dir = var("OUT_DIR")
.map(PathBuf::from)
.or_else(|_| TempDir::new("tendermint_proto_out").map(|d| d.into_path()))
.or_else(|_| tempdir().map(|d| d.into_path()))
.unwrap();
let tendermint_dir = PathBuf::from(var("TENDERMINT_DIR").unwrap_or_else(|_| {
root.join("..")
Expand Down