diff --git a/crates/bitcoind_rpc/tests/test_emitter.rs b/crates/bitcoind_rpc/tests/test_emitter.rs index 8c41efc03..be61b3df7 100644 --- a/crates/bitcoind_rpc/tests/test_emitter.rs +++ b/crates/bitcoind_rpc/tests/test_emitter.rs @@ -1,3 +1,5 @@ +#![cfg(not(docsrs))] + use std::collections::{BTreeMap, BTreeSet}; use bdk_bitcoind_rpc::Emitter; diff --git a/crates/electrum/tests/test_electrum.rs b/crates/electrum/tests/test_electrum.rs index 5f032ba6c..28c23cbc7 100644 --- a/crates/electrum/tests/test_electrum.rs +++ b/crates/electrum/tests/test_electrum.rs @@ -1,3 +1,5 @@ +#![cfg(not(docsrs))] + use bdk_chain::{ bitcoin::{hashes::Hash, Address, Amount, ScriptBuf, WScriptHash}, local_chain::LocalChain, diff --git a/crates/esplora/src/async_ext.rs b/crates/esplora/src/async_ext.rs index ca5111613..fea8605d8 100644 --- a/crates/esplora/src/async_ext.rs +++ b/crates/esplora/src/async_ext.rs @@ -503,6 +503,7 @@ mod test { } /// Ensure that update does not remove heights (from original), and all anchor heights are included. + #[cfg(not(docsrs))] #[tokio::test] pub async fn test_finalize_chain_update() -> anyhow::Result<()> { struct TestCase<'a> { diff --git a/crates/esplora/src/blocking_ext.rs b/crates/esplora/src/blocking_ext.rs index b740a21db..62db1e178 100644 --- a/crates/esplora/src/blocking_ext.rs +++ b/crates/esplora/src/blocking_ext.rs @@ -492,6 +492,7 @@ mod test { } /// Ensure that update does not remove heights (from original), and all anchor heights are included. + #[cfg(not(docsrs))] #[test] pub fn test_finalize_chain_update() -> anyhow::Result<()> { struct TestCase<'a> { @@ -655,6 +656,7 @@ mod test { Ok(()) } + #[cfg(not(docsrs))] #[test] fn update_local_chain() -> anyhow::Result<()> { const TIP_HEIGHT: u32 = 50; diff --git a/crates/esplora/tests/async_ext.rs b/crates/esplora/tests/async_ext.rs index b535d2bfa..f6dd06317 100644 --- a/crates/esplora/tests/async_ext.rs +++ b/crates/esplora/tests/async_ext.rs @@ -1,3 +1,5 @@ +#![cfg(not(docsrs))] + use bdk_chain::spk_client::{FullScanRequest, SyncRequest}; use bdk_chain::{ConfirmationBlockTime, TxGraph}; use bdk_esplora::EsploraAsyncExt; diff --git a/crates/esplora/tests/blocking_ext.rs b/crates/esplora/tests/blocking_ext.rs index d4191ceb0..6eee910f4 100644 --- a/crates/esplora/tests/blocking_ext.rs +++ b/crates/esplora/tests/blocking_ext.rs @@ -1,3 +1,5 @@ +#![cfg(not(docsrs))] + use bdk_chain::spk_client::{FullScanRequest, SyncRequest}; use bdk_chain::{ConfirmationBlockTime, TxGraph}; use bdk_esplora::EsploraExt; diff --git a/crates/testenv/src/lib.rs b/crates/testenv/src/lib.rs index abf4cac43..f845bd653 100644 --- a/crates/testenv/src/lib.rs +++ b/crates/testenv/src/lib.rs @@ -1,3 +1,5 @@ +#![cfg_attr(docsrs, feature(doc_cfg))] + pub mod utils; use bdk_chain::{ @@ -25,12 +27,14 @@ use std::time::Duration; /// Struct for running a regtest environment with a single `bitcoind` node with an `electrs` /// instance connected to it. +#[cfg_attr(docsrs, doc(cfg(not(docsrs))))] pub struct TestEnv { pub bitcoind: electrsd::bitcoind::BitcoinD, pub electrsd: electrsd::ElectrsD, } /// Configuration parameters. +#[cfg_attr(docsrs, doc(cfg(not(docsrs))))] #[derive(Debug)] pub struct Config<'a> { /// [`bitcoind::Conf`] @@ -39,6 +43,7 @@ pub struct Config<'a> { pub electrsd: electrsd::Conf<'a>, } +#[cfg(not(docsrs))] impl<'a> Default for Config<'a> { /// Use the default configuration plus set `http_enabled = true` for [`electrsd::Conf`] /// which is required for testing `bdk_esplora`. @@ -54,6 +59,7 @@ impl<'a> Default for Config<'a> { } } +#[cfg(not(docsrs))] impl TestEnv { /// Construct a new [`TestEnv`] instance with the default configuration used by BDK. pub fn new() -> anyhow::Result { @@ -310,7 +316,7 @@ impl TestEnv { } } -#[cfg(test)] +#[cfg(all(test, not(docsrs)))] mod test { use crate::TestEnv; use core::time::Duration;