Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3b7aa55

Browse files
author
Kotsias, Panagiotis-Christos
committed
Added logging
1 parent 614a11b commit 3b7aa55

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/test_modules.py

+14
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ def load(fname):
1212
return json.load(f)
1313

1414

15+
def dump(data, fname):
16+
with open(fname, "w") as f:
17+
json.dump(data, f, indent=2)
18+
19+
1520
class Case(TestCase):
1621
_MODULE = ""
1722

@@ -24,6 +29,15 @@ def test_methods(self):
2429
if v["module"] == self._MODULE:
2530
res = getattr(etherscan, fun)(**v["kwargs"])
2631
print(f"METHOD: {fun}, RTYPE: {type(res)}")
32+
# Create log files (will update existing ones)
33+
fname = f"logs/{fun}.json"
34+
log = {
35+
"name": fun,
36+
"module": v["module"],
37+
"kwargs": v["kwargs"],
38+
"res": res,
39+
}
40+
dump(log, fname)
2741

2842

2943
class TestAccounts(Case):

0 commit comments

Comments
 (0)