Skip to content

Commit

Permalink
Using lazy_static for logging
Browse files Browse the repository at this point in the history
  • Loading branch information
0xCAB0 committed Jul 27, 2024
1 parent f2fa2e1 commit c15639e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ log = "0.4.20"
lazy_static = "1.4.0"
[dev-dependencies]
env_logger = "0.11.5"
once_cell = "1.19.0"
redis-macros = { version = "0.3.0" }
redis = { version = "0.24.0" }

Expand Down
12 changes: 7 additions & 5 deletions src/tests/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ use crate::queries::VintedWrapperError;
use crate::VintedWrapper;
use bb8_postgres::tokio_postgres::NoTls;
use env_logger;
use once_cell::sync::Lazy;
use lazy_static::lazy_static;

const DB_URL: &str = "postgres://postgres:postgres@localhost/vinted-rs";
const POOL_SIZE: u32 = 5;

static INIT: Lazy<()> = Lazy::new(|| {
env_logger::builder().is_test(true).init();
});
lazy_static! {
static ref INIT: () = {
env_logger::builder().is_test(true).init();
};
}

fn _calculate_color_props(hex_color1: &str) -> (f64, f64, f64) {
let color1 = _hex_to_rgb(hex_color1);
Expand Down Expand Up @@ -304,7 +306,7 @@ async fn test_get_items_by_currency() {

#[tokio::test]
async fn test_get_advanced_items() {
Lazy::force(&INIT);
lazy_static::initialize(&INIT);
let db = DbController::new("postgres://postgres:postgres@localhost/vinted-rs", 5, NoTls)
.await
.unwrap();
Expand Down

0 comments on commit c15639e

Please sign in to comment.