From afb2ea94cdcb308cda07402010bfce8e1e280235 Mon Sep 17 00:00:00 2001 From: Christopher Morton Date: Thu, 1 Aug 2024 20:27:59 +0100 Subject: [PATCH] Remove dotenvy from test suite --- test_util/Cargo.toml | 3 --- test_util/src/lib.rs | 2 +- test_util/src/tests/mod.rs | 2 -- test_util/src/tests/testenv.rs | 42 ---------------------------------- 4 files changed, 1 insertion(+), 48 deletions(-) diff --git a/test_util/Cargo.toml b/test_util/Cargo.toml index a45d5cb6..65133121 100644 --- a/test_util/Cargo.toml +++ b/test_util/Cargo.toml @@ -18,6 +18,3 @@ rust-version = "1.68.0" [dependencies] tempfile = "3.3.0" once_cell = "1.16.0" - -[dev-dependencies] -dotenvy = { path = "../dotenv", version = "0.15.7" } diff --git a/test_util/src/lib.rs b/test_util/src/lib.rs index 74cda18d..0008d75e 100644 --- a/test_util/src/lib.rs +++ b/test_util/src/lib.rs @@ -26,7 +26,7 @@ //! //! ## Example //! -//! ```no_run +//! ```rust,ignore //! use dotenvy_test_util::*; //! use dotenvy::dotenv_override; //! diff --git a/test_util/src/tests/mod.rs b/test_util/src/tests/mod.rs index 1ae0b7da..69abda1d 100644 --- a/test_util/src/tests/mod.rs +++ b/test_util/src/tests/mod.rs @@ -16,8 +16,6 @@ const CUSTOM_VARS: &[(&str, &str)] = &[ ("CUSTOM_KEY_2", "CUSTOM_VALUE_2"), ]; -const DOTENV_EXPECT: &str = "TestEnv should have .env file"; - fn test_env_files(testenv: &TestEnv) -> Result<(), Error> { let files = testenv.env_files(); diff --git a/test_util/src/tests/testenv.rs b/test_util/src/tests/testenv.rs index 8d38ff09..2d6a0967 100644 --- a/test_util/src/tests/testenv.rs +++ b/test_util/src/tests/testenv.rs @@ -1,5 +1,4 @@ use super::*; -use dotenvy::dotenv; mod new { use std::collections::HashMap; @@ -28,7 +27,6 @@ mod new { test_in_env(&testenv, || { assert!(!env_file_path.exists()); - assert!(dotenv().is_err()); }) } @@ -69,18 +67,6 @@ mod new_with_env_file { test_env_files(&testenv) } - #[test] - fn env_file_loaded_vars_state() -> Result<(), Error> { - let testenv = testenv_with_test_env_file()?; - test_in_env(&testenv, || { - dotenv().expect(DOTENV_EXPECT); - // dotenv() does not override existing var - // but existing key is not set in this testenv - assert_env_var(EXISTING_KEY, OVERRIDING_VALUE); - assert_env_var(TEST_KEY, TEST_VALUE); - }) - } - #[test] fn custom_env_file_vars_state() -> Result<(), Error> { let testenv = testenv_with_custom_env_file()?; @@ -98,46 +84,18 @@ mod new_with_env_file { test_env_files(&testenv) } - #[test] - fn custom_env_file_loaded_vars_state() -> Result<(), Error> { - let testenv = testenv_with_custom_env_file()?; - test_in_env(&testenv, || { - dotenv().expect(DOTENV_EXPECT); - assert_test_keys_unset(); - assert_env_vars(CUSTOM_VARS); - }) - } - #[test] fn empty_env_file_exists() -> Result<(), Error> { let testenv = testenv_with_empty_env_file()?; test_env_files(&testenv) } - #[test] - fn empty_env_file_loaded_vars_state() -> Result<(), Error> { - let testenv = testenv_with_empty_env_file()?; - test_in_env(&testenv, || { - dotenv().expect(DOTENV_EXPECT); - assert_test_keys_unset(); - }) - } - #[test] fn custom_bom_env_file_exists() -> Result<(), Error> { let testenv = testenv_with_custom_bom_env_file()?; test_env_files(&testenv) } - #[test] - fn custom_bom_env_file_loaded_vars_state() -> Result<(), Error> { - let testenv = testenv_with_custom_bom_env_file()?; - test_in_env(&testenv, || { - dotenv().expect(DOTENV_EXPECT); - assert_env_var(TEST_KEY, TEST_VALUE); - }) - } - fn testenv_with_test_env_file() -> Result { let env_file = create_test_env_file(); TestEnv::new_with_env_file(env_file)