Skip to content

Commit e5a9f2f

Browse files
committed
Merge bitcoin/bitcoin#28194: test: python E721 and flake8 updates
bee2d57 script: update flake8 to 6.1.0 (Jon Atack) 38c3fd8 test: python E721 updates (Jon Atack) Pull request description: Update our functional tests per [E721](https://www.flake8rules.com/rules/E721.html) enforced by [flake8 6.1.0](https://flake8.pycqa.org/en/latest/release-notes/6.1.0.html), and update our CI lint task to use that release. This makes the following linter output on current master with flake8 6.1.0 green. ``` $ ./test/lint/lint-python.py ; ./test/lint/lint-spelling.py test/functional/p2p_invalid_locator.py:35:16: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()` test/functional/test_framework/siphash.py:34:12: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()` test/functional/test_framework/siphash.py:64:12: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()` src/test/fuzz/descriptor_parse.cpp:88: occurences ==> occurrences ^ Warning: codespell identified likely spelling errors. Any false positives? Add them to the list of ignored words in test/lint/spelling.ignore-words.txt ``` ACKs for top commit: MarcoFalke: lgtm ACK bee2d57 Tree-SHA512: f3788a543ca98e44eeeba1d06c32f1b11eec95d4aef068aa1b6b5c401261adfa3fb6c6d6c769f3fe6839d78e74a310d5c926867e7c367d6513a53d580fd376f3
2 parents fadad10 + bee2d57 commit e5a9f2f

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

ci/lint/04_install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ python3 --version
3535

3636
${CI_RETRY_EXE} pip3 install \
3737
codespell==2.2.5 \
38-
flake8==6.0.0 \
38+
flake8==6.1.0 \
3939
lief==0.13.2 \
4040
mypy==1.4.1 \
4141
pyzmq==25.1.0 \

src/test/fuzz/descriptor_parse.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class MockedDescriptorConverter {
8585
std::string desc;
8686
desc.reserve(mocked_desc.size());
8787

88-
// Replace all occurences of '%' followed by two hex characters with the corresponding key.
88+
// Replace all occurrences of '%' followed by two hex characters with the corresponding key.
8989
for (size_t i = 0; i < mocked_desc.size();) {
9090
if (mocked_desc[i] == '%') {
9191
if (i + 3 >= mocked_desc.size()) return {};

test/functional/p2p_invalid_locator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def run_test(self):
3232
within_max_peer = node.add_p2p_connection(P2PInterface())
3333
msg.locator.vHave = [int(node.getblockhash(i - 1), 16) for i in range(block_count, block_count - (MAX_LOCATOR_SZ), -1)]
3434
within_max_peer.send_message(msg)
35-
if type(msg) == msg_getheaders:
35+
if type(msg) is msg_getheaders:
3636
within_max_peer.wait_for_header(node.getbestblockhash())
3737
else:
3838
within_max_peer.wait_for_block(int(node.getbestblockhash(), 16))

test/functional/test_framework/siphash.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def siphash_round(v0, v1, v2, v3):
3131

3232

3333
def siphash(k0, k1, data):
34-
assert type(data) == bytes
34+
assert type(data) is bytes
3535
v0 = 0x736f6d6570736575 ^ k0
3636
v1 = 0x646f72616e646f6d ^ k1
3737
v2 = 0x6c7967656e657261 ^ k0
@@ -61,5 +61,5 @@ def siphash(k0, k1, data):
6161

6262

6363
def siphash256(k0, k1, num):
64-
assert type(num) == int
64+
assert type(num) is int
6565
return siphash(k0, k1, num.to_bytes(32, 'little'))

0 commit comments

Comments
 (0)