Skip to content

Commit 651ebca

Browse files
committed
Expose test utils behind the test-utils feature gate
Signed-off-by: Simon Völcker <simon.voelcker@frequenz.com>
1 parent e19764b commit 651ebca

4 files changed

Lines changed: 11 additions & 4 deletions

File tree

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,15 @@ tonic = "0.14"
2323
tonic-prost = "0.14"
2424
tracing = { version = "0.1" }
2525
tracing-subscriber = { version = "0.3" }
26+
tokio-stream = { version = "0.1.17", features = ["sync"], optional = true }
2627

2728
[dev-dependencies]
2829
tracing-subscriber = { version = "0.3", features = ["std", "env-filter"] }
2930
tokio = { version = "1.48", features = ["test-util"] }
3031
tokio-stream = { version = "0.1.17", features = ["sync"] }
3132

32-
3333
[build-dependencies]
3434
tonic-prost-build = { version = "0.14", features = ["cleanup-markdown"] }
35+
36+
[features]
37+
test-utils = ["dep:tokio-stream"]

src/client.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ pub use proto::common::microgrid::electrical_components::{
1818
ElectricalComponent, ElectricalComponentCategory,
1919
};
2020

21-
#[cfg(test)]
22-
pub(crate) mod test_utils;
21+
#[cfg(any(test, feature = "test-utils"))]
22+
#[expect(clippy::unwrap_used, clippy::panic, clippy::expect_used)]
23+
pub mod test_utils;

src/client/proto.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ mod pb {
1717
// Only export what we need
1818
pub use pb::frequenz::api::common::v1alpha8 as common;
1919
pub use pb::frequenz::api::microgrid::v1alpha18 as microgrid;
20-
#[cfg(test)]
20+
#[cfg(any(test, feature = "test-utils"))]
2121
pub use pb::google;
2222

2323
mod electrical_component;

src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,6 @@ pub(crate) mod wall_clock_timer;
3838

3939
mod microgrid;
4040
pub use microgrid::{BatteryPool, Microgrid};
41+
42+
#[cfg(any(test, feature = "test-utils"))]
43+
pub use client::test_utils;

0 commit comments

Comments
 (0)