bdk icon indicating copy to clipboard operation
bdk copied to clipboard

test: consolidate esplora blocking and async test code

Open notmandatory opened this issue 2 years ago • 9 comments

There should be a way to consolidate blocking and async tests and TestEnv (probably with macros as Alekos originally did).

Originally posted by @notmandatory in https://github.com/bitcoindevkit/bdk/pull/1110#discussion_r1316601369

notmandatory avatar Sep 06 '23 02:09 notmandatory

@notmandatory do you think this can be labelled as a good first issue?

vladimirfomene avatar Sep 06 '23 17:09 vladimirfomene

Good day team, can I contribute to this? Although I will need some briefing .

ikeogu avatar Mar 05 '24 08:03 ikeogu

@ikeogu yes feel free to work on this, but first look over the code and post here or ask on discord if you have any questions before you get started.

notmandatory avatar Mar 05 '24 20:03 notmandatory

@notmandatory I would like to contribute to this issue Correct me if I am wrong, Currently we have two separate tests for each blocking and async, and as you mention it is possible to have common tests covering both blocking and async ones

srikanth-iyengar avatar Mar 20 '24 17:03 srikanth-iyengar

@srikanth-iyengar I think we need to figure out #1375 first, however that gets solved we should be able to use the same approach for this issue. What are your thoughts regarding the best way to consolidate async and blocking rust code?

notmandatory avatar Mar 20 '24 20:03 notmandatory

I was thinking of something like

#[test_sync_async()]
fn test_both_sync_async() {
    let some_value = some_macro!( // this macro will decide which one to pick async or blocking 
         async { async_function().await },
        || sync_function()
    );
}

Will this be possible ? or we should go with synca

srikanth-iyengar avatar Mar 21 '24 04:03 srikanth-iyengar