mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-11 14:11:09 +00:00
proc-macro/tests: Adjust subxt-test proc-macro
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
@@ -28,21 +28,21 @@ pub fn subxt_test(attr: TokenStream, item: TokenStream) -> TokenStream {
|
||||
let func_vis = &func.vis;
|
||||
let func_sig = &func.sig;
|
||||
let func_block = &func.block;
|
||||
let func_output = &func.sig.output;
|
||||
|
||||
let func_name = &func.sig.ident;
|
||||
let inner_func_name = format_ident!("{}_inner", func_name);
|
||||
let mut inner_func_sig = func.sig.clone();
|
||||
inner_func_sig.ident = format_ident!("{}_inner", inner_func_sig.ident);
|
||||
let inner_func_name = &inner_func_sig.ident;
|
||||
|
||||
let result = quote! {
|
||||
#[tokio::test]
|
||||
#( #func_attrs )*
|
||||
#func_vis #func_sig #func_output {
|
||||
async fn #inner_func_name() #func_output
|
||||
#func_vis #func_sig {
|
||||
#func_vis #inner_func_sig
|
||||
#func_block
|
||||
|
||||
tokio::time::timeout(std::time::Duration::from_secs(#timeout_duration), #inner_func_name())
|
||||
.await
|
||||
.expect("Test timedout");
|
||||
.expect("Test timedout")
|
||||
}
|
||||
};
|
||||
result.into()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
|
||||
// see LICENSE for license details.
|
||||
|
||||
use crate::test_context;
|
||||
use crate::{subxt_test, test_context};
|
||||
use codec::{Compact, Encode};
|
||||
use futures::StreamExt;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
//! Just sanity checking some of the legacy RPC methods to make
|
||||
//! sure they don't error out and can decode their results OK.
|
||||
|
||||
use crate::test_context;
|
||||
use crate::{subxt_test, test_context};
|
||||
|
||||
#[subxt_test(timeout = 800)]
|
||||
async fn chain_get_block_hash() {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// see LICENSE for license details.
|
||||
|
||||
use crate::{
|
||||
submit_tx_wait_for_finalized_success, test_context,
|
||||
submit_tx_wait_for_finalized_success, subxt_test, test_context,
|
||||
utils::{node_runtime, wait_for_blocks},
|
||||
};
|
||||
use codec::{Decode, Encode};
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
//! Just sanity checking some of the new RPC methods to try and
|
||||
//! catch differences as the implementations evolve.
|
||||
|
||||
use crate::{test_context, utils::node_runtime};
|
||||
use crate::{subxt_test, test_context, utils::node_runtime};
|
||||
use assert_matches::assert_matches;
|
||||
use codec::Encode;
|
||||
use futures::Stream;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
use crate::{
|
||||
node_runtime::{self, balances, runtime_types, system},
|
||||
submit_tx_wait_for_finalized_success, test_context,
|
||||
submit_tx_wait_for_finalized_success, subxt_test, test_context,
|
||||
};
|
||||
use codec::Decode;
|
||||
use subxt::{
|
||||
|
||||
@@ -9,7 +9,8 @@ use crate::{
|
||||
runtime_types::{pallet_contracts::wasm::Determinism, sp_weights::weight_v2::Weight},
|
||||
system,
|
||||
},
|
||||
submit_tx_wait_for_finalized_success, test_context, TestClient, TestConfig, TestContext,
|
||||
submit_tx_wait_for_finalized_success, subxt_test, test_context, TestClient, TestConfig,
|
||||
TestContext,
|
||||
};
|
||||
use subxt::ext::futures::StreamExt;
|
||||
use subxt::{tx::TxProgress, utils::MultiAddress, Config, Error};
|
||||
|
||||
@@ -11,7 +11,7 @@ use crate::{
|
||||
},
|
||||
staking,
|
||||
},
|
||||
submit_tx_wait_for_finalized_success, test_context,
|
||||
submit_tx_wait_for_finalized_success, subxt_test, test_context,
|
||||
};
|
||||
use assert_matches::assert_matches;
|
||||
use subxt::error::{DispatchError, Error};
|
||||
|
||||
@@ -8,7 +8,7 @@ use crate::{
|
||||
runtime_types::{self, sp_weights::weight_v2::Weight},
|
||||
sudo,
|
||||
},
|
||||
submit_tx_wait_for_finalized_success, test_context,
|
||||
submit_tx_wait_for_finalized_success, subxt_test, test_context,
|
||||
};
|
||||
use subxt_signer::sr25519::dev;
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
use crate::{
|
||||
node_runtime::{self, system},
|
||||
submit_tx_wait_for_finalized_success, test_context,
|
||||
submit_tx_wait_for_finalized_success, subxt_test, test_context,
|
||||
};
|
||||
use assert_matches::assert_matches;
|
||||
use subxt_signer::sr25519::dev;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
|
||||
// see LICENSE for license details.
|
||||
|
||||
use crate::{node_runtime, test_context};
|
||||
use crate::{node_runtime, subxt_test, test_context};
|
||||
|
||||
#[subxt_test(timeout = 800)]
|
||||
async fn storage_get_current_timestamp() {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
|
||||
// see LICENSE for license details.
|
||||
|
||||
use crate::{node_runtime, test_context, TestContext};
|
||||
use crate::{node_runtime, subxt_test, test_context, TestContext};
|
||||
use frame_metadata::v15::{
|
||||
CustomMetadata, ExtrinsicMetadata, OuterEnums, PalletCallMetadata, PalletMetadata,
|
||||
PalletStorageMetadata, RuntimeMetadataV15, StorageEntryMetadata, StorageEntryModifier,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
|
||||
// see LICENSE for license details.
|
||||
|
||||
use crate::{node_runtime, submit_tx_wait_for_finalized_success, test_context};
|
||||
use crate::{node_runtime, submit_tx_wait_for_finalized_success, subxt_test, test_context};
|
||||
use codec::Encode;
|
||||
use subxt::utils::AccountId32;
|
||||
use subxt_signer::sr25519::dev;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This file is dual-licensed as Apache-2.0 or GPL-3.0.
|
||||
// see LICENSE for license details.
|
||||
|
||||
use crate::{node_runtime, test_context, utils::wait_for_blocks};
|
||||
use crate::{node_runtime, subxt_test, test_context, utils::wait_for_blocks};
|
||||
|
||||
#[cfg(fullclient)]
|
||||
use subxt::utils::AccountId32;
|
||||
|
||||
Reference in New Issue
Block a user