Skip to content

Commit

Permalink
Standardize RUST_LOG configuration test setup (#6506)
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb committed Jun 2, 2023
1 parent 3466522 commit 21a14a1
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 19 deletions.
1 change: 1 addition & 0 deletions datafusion/core/tests/memory_limit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ use test_utils::AccessLogGenerator;
#[cfg(test)]
#[ctor::ctor]
fn init() {
// Enable RUST_LOG logging configuration for test
let _ = env_logger::try_init();
}

Expand Down
7 changes: 0 additions & 7 deletions datafusion/core/tests/parquet/filter_pushdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,6 @@ fn generate_file(tempdir: &TempDir, props: WriterProperties) -> TestParquetFile
test_parquet_file
}

#[cfg(test)]
#[ctor::ctor]
fn init() {
// enable logging so RUST_LOG works
let _ = env_logger::try_init();
}

#[cfg(not(target_family = "windows"))]
#[tokio::test]
async fn single_file() {
Expand Down
7 changes: 7 additions & 0 deletions datafusion/core/tests/parquet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ mod filter_pushdown;
mod page_pruning;
mod row_group_pruning;

#[cfg(test)]
#[ctor::ctor]
fn init() {
// Enable RUST_LOG logging configuration for test
let _ = env_logger::try_init();
}

// ----------------------
// Begin test fixture
// ----------------------
Expand Down
6 changes: 0 additions & 6 deletions datafusion/core/tests/sql/subqueries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ use datafusion::assert_batches_eq;
use datafusion::prelude::SessionContext;
use log::debug;

#[cfg(test)]
#[ctor::ctor]
fn init() {
let _ = env_logger::try_init();
}

#[tokio::test]
async fn correlated_recursive_scalar_subquery() -> Result<()> {
let ctx = SessionContext::new();
Expand Down
7 changes: 7 additions & 0 deletions datafusion/core/tests/sql_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,10 @@

/// Run all tests that are found in the `sql` directory
mod sql;

#[cfg(test)]
#[ctor::ctor]
fn init() {
// Enable RUST_LOG logging configuration for test
let _ = env_logger::try_init();
}
5 changes: 0 additions & 5 deletions datafusion/expr/src/expr_rewriter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,6 @@ mod test {
use datafusion_common::tree_node::{RewriteRecursion, TreeNode, TreeNodeRewriter};
use datafusion_common::{DFField, DFSchema, ScalarValue};

#[ctor::ctor]
fn init() {
let _ = env_logger::try_init();
}

#[derive(Default)]
struct RecordingRewriter {
v: Vec<String>,
Expand Down
7 changes: 7 additions & 0 deletions datafusion/expr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,10 @@ pub use udaf::AggregateUDF;
pub use udf::ScalarUDF;
pub use window_frame::{WindowFrame, WindowFrameBound, WindowFrameUnits};
pub use window_function::{BuiltInWindowFunction, WindowFunction};

#[cfg(test)]
#[ctor::ctor]
fn init() {
// Enable RUST_LOG logging configuration for test
let _ = env_logger::try_init();
}
2 changes: 1 addition & 1 deletion datafusion/optimizer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ mod plan_signature;
#[cfg(test)]
#[ctor::ctor]
fn init() {
// Enable logging for tests
// Enable RUST_LOG logging configuration for test
let _ = env_logger::try_init();
}
1 change: 1 addition & 0 deletions datafusion/optimizer/tests/integration-test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ use std::sync::Arc;
#[cfg(test)]
#[ctor::ctor]
fn init() {
// enable logging so RUST_LOG works
let _ = env_logger::try_init();
}

Expand Down
1 change: 1 addition & 0 deletions datafusion/sql/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ use rstest::rstest;
#[cfg(test)]
#[ctor::ctor]
fn init() {
// Enable RUST_LOG logging configuration for tests
let _ = env_logger::try_init();
}

Expand Down

0 comments on commit 21a14a1

Please sign in to comment.