Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8e6380d

Browse files
committed
Added testnets on module tests
1 parent61abdba commit8e6380d

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

‎test/test_modules.py‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
frometherscan.etherscanimportEtherscan
88

9-
CONFIG_PATH="etherscan/configs/stable.json"
9+
CONFIG_PATH="etherscan/configs/{}-stable.json"
1010
API_KEY=os.environ["API_KEY"]# Encrypted env var by Travis
1111

1212

@@ -22,18 +22,20 @@ def dump(data, fname):
2222

2323
classCase(TestCase):
2424
_MODULE=""
25+
_NETS= ["MAIN","GOERLI","KOVAN","RINKEBY","ROPSTEN"]
2526

26-
deftest_methods(self):
27-
print(f"\nMODULE:{self._MODULE}")
28-
config=load(CONFIG_PATH)
29-
etherscan=Etherscan(API_KEY)
27+
defmethods(self,net):
28+
print(f"\nNET:{net}")
29+
print(f"MODULE:{self._MODULE}")
30+
config=load(CONFIG_PATH.format(net))
31+
etherscan=Etherscan(API_KEY,net)
3032
forfun,vinconfig.items():
3133
ifnotfun.startswith("_"):# disabled if _
3234
ifv["module"]==self._MODULE:
3335
res=getattr(etherscan,fun)(**v["kwargs"])
3436
print(f"METHOD:{fun}, RTYPE:{type(res)}")
3537
# Create log files (will update existing ones)
36-
fname=f"logs/standard/{fun}.json"
38+
fname=f"logs/standard/{net}-{fun}.json"
3739
log= {
3840
"method":fun,
3941
"module":v["module"],
@@ -43,6 +45,10 @@ def test_methods(self):
4345
}
4446
dump(log,fname)
4547

48+
deftest_net_methods(self):
49+
fornetinself._NETS:
50+
self.methods(net)
51+
4652

4753
classTestAccounts(Case):
4854
_MODULE="accounts"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp