Skip to content

Commit 6e26592

Browse files
committed
sync env var in test
1 parent 4726260 commit 6e26592

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tmc-langs-util/src/task_executor/submission_packaging.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,12 @@ mod test {
404404
use super::*;
405405
use std::fs;
406406
use std::path::PathBuf;
407+
use std::sync::Once;
407408
use tempfile::TempDir;
408409
use walkdir::WalkDir;
409410

411+
static LOG_ENV: Once = Once::new();
412+
410413
const MAVEN_CLONE: &str = "tests/data/MavenExercise";
411414
const MAVEN_ZIP: &str = "tests/data/MavenExercise.zip";
412415

@@ -417,9 +420,11 @@ mod test {
417420
const PYTHON_ZIP: &str = "tests/data/PythonExercise.zip";
418421

419422
fn init() {
420-
if std::env::var("RUST_LOG").is_err() {
421-
std::env::set_var("RUST_LOG", "debug,j4rs=warn");
422-
}
423+
LOG_ENV.call_once(|| {
424+
if std::env::var("RUST_LOG").is_err() {
425+
std::env::set_var("RUST_LOG", "debug,j4rs=warn");
426+
}
427+
});
423428
let _ = env_logger::builder().is_test(true).try_init();
424429
}
425430

0 commit comments

Comments
 (0)