Skip to content

Commit 0948d24

Browse files
committed
fix(testenv): disable downloads (bitcoind and electrsd) for docs.rs builds in crate testenv
1 parent dc0511f commit 0948d24

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

crates/testenv/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@ use std::time::Duration;
2525

2626
/// Struct for running a regtest environment with a single `bitcoind` node with an `electrs`
2727
/// instance connected to it.
28+
#[cfg_attr(docsrs, doc(cfg(not(docsrs))))]
2829
pub struct TestEnv {
2930
pub bitcoind: electrsd::bitcoind::BitcoinD,
3031
pub electrsd: electrsd::ElectrsD,
3132
}
3233

3334
/// Configuration parameters.
35+
#[cfg_attr(docsrs, doc(cfg(not(docsrs))))]
3436
#[derive(Debug)]
3537
pub struct Config<'a> {
3638
/// [`bitcoind::Conf`]
@@ -39,6 +41,7 @@ pub struct Config<'a> {
3941
pub electrsd: electrsd::Conf<'a>,
4042
}
4143

44+
#[cfg(not(docsrs))]
4245
impl<'a> Default for Config<'a> {
4346
/// Use the default configuration plus set `http_enabled = true` for [`electrsd::Conf`]
4447
/// which is required for testing `bdk_esplora`.
@@ -54,6 +57,7 @@ impl<'a> Default for Config<'a> {
5457
}
5558
}
5659

60+
#[cfg(not(docsrs))]
5761
impl TestEnv {
5862
/// Construct a new [`TestEnv`] instance with the default configuration used by BDK.
5963
pub fn new() -> anyhow::Result<Self> {
@@ -310,7 +314,7 @@ impl TestEnv {
310314
}
311315
}
312316

313-
#[cfg(test)]
317+
#[cfg(all(test, not(docsrs)))]
314318
mod test {
315319
use crate::TestEnv;
316320
use core::time::Duration;

0 commit comments

Comments
 (0)