Skip to content

Commit e7bddee

Browse files
committed
Added test-utils feature, added gating
Signed-off-by: Simon Völcker <simon.voelcker@frequenz.com>
1 parent 39596a5 commit e7bddee

4 files changed

Lines changed: 10 additions & 3 deletions

File tree

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@ tokio = { version = "1.48", features = ["test-util"] }
3232

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

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)