Remove unused testing code.
Rationale:
- Less is more :-)
- Unused code is by definition "untested"
- YAGNI
Remove unused testing code.
Rationale:
514 | @@ -515,18 +515,6 @@ def skip_if_no_wallet(self): 515 | if not self.is_wallet_compiled(): 516 | raise SkipTest("wallet has not been compiled.") 517 | 518 | - def skip_if_no_cli(self):
Should probably call this:
diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py
index 9a589240a8..238b50387d 100755
--- a/test/functional/test_framework/test_framework.py
+++ b/test/functional/test_framework/test_framework.py
@@ -161,8 +161,10 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
success = TestStatus.FAILED
try:
- if self.options.usecli and not self.supports_cli:
- raise SkipTest("--usecli specified but test does not support using CLI")
+ if self.options.usecli:
+ if not self.supports_cli:
+ raise SkipTest("--usecli specified but test does not support using CLI")
+ self.skip_if_no_cli()
self.skip_test_if_missing_module()
self.setup_chain()
self.setup_network()
312 | @@ -313,7 +313,7 @@ def on_ping(self, message): 313 | self.send_message(msg_pong(message.nonce)) 314 | 315 | def on_verack(self, message): 316 | - self.verack_received = True 317 | + pass
ack
1079 | - 1080 | - def serialize(self): 1081 | - return self.data 1082 | - 1083 | - def __repr__(self): 1084 | - return "msg_generic()"
ack
53 | @@ -54,9 +54,6 @@ 54 | def sha256(s): 55 | return hashlib.new('sha256', s).digest() 56 | 57 | -def ripemd160(s): 58 | - return hashlib.new('ripemd160', s).digest()
When has this last been used? Not sure if we want to remove library functions that are still used in other branches. Same for the key.py changes.
Last use was removed in b9f34e84befa7db6ff8c9b92a09d0dfa40388fb7
ack
24 | @@ -25,7 +25,7 @@ 25 | 26 | # Reject codes that we might receive in this test 27 | REJECT_INVALID = 16 28 | -REJECT_OBSOLETE = 17 29 | +# REJECT_OBSOLETE = 17
When was the first and last use? Might want to remove altogether after investigating that.
Last use was removed in your commit fac3e22b18cd29053bc17065fd75db7b84ba6f40 :-)
So please remove the constants here as well.
<!--e57a25ab6845829454e8d69fc972939a-->No more conflicts as of last run.
@MarcoFalke Thanks for the quick review. Updated. Please re-review :-)
30 | @@ -31,7 +31,7 @@ 31 | MY_SUBVERSION = b"/python-mininode-tester:0.0.3/" 32 | MY_RELAY = 1 # from version 70001 onwards, fRelay should be appended to version messages (BIP37) 33 | 34 | -MAX_INV_SZ = 50000 35 | +# MAX_INV_SZ = 50000
remove? (This is no longer used after the removal of the comptool)
Done!
<!--32850dd3fdea838b4049e64f46995ea2-->
| Coverage | Change (pull 14312) | Reference (master) |
|---|---|---|
| Lines | -0.0154 % | 87.0361 % |
| Functions | +0.0926 % | 84.1130 % |
| Branches | -0.0199 % | 51.5451 % |
160 | @@ -161,8 +161,10 @@ def main(self): 161 | success = TestStatus.FAILED 162 | 163 | try: 164 | - if self.options.usecli and not self.supports_cli: 165 | - raise SkipTest("--usecli specified but test does not support using CLI") 166 | + if self.options.usecli: 167 | + if not self.supports_cli: 168 | + raise SkipTest("--usecli specified but test does not support using CLI") 169 | + self.skip_if_no_cli()
Does this change belong here?
That was suggested by @MarcoFalke in #14312 (review) :-)
1130 | @@ -1136,7 +1131,6 @@ def serialize(self): 1131 | def __repr__(self): 1132 | return "msg_block(block=%s)" % (repr(self.block)) 1133 | 1134 | -
nit, unrelated.
Concept ACK, agree with rationale.
Mind sharing how you find these unused code?