Page MenuHomePhabricator

[test refactoring] move AvaP2PInterface to avatools.py
ClosedPublic

Authored by PiRK on Jun 14 2021, 16:31.

Details

Reviewers
majcosta
Group Reviewers
Restricted Project
Commits
rABC428dca79cbbe: [test refactoring] move AvaP2PInterface to avatools.py
Summary

This is a first step in refactoring abc_p2p_avalanche.py, because it is testing too many things. The avalanche enabled P2PInterface used in this file will be reused in multiple tests after this is split up into smaller pieces.

This commit does the following:

  • move abc_p2p_avalanche.TestNode to test_framework.avatools.AvaP2PInterface
  • move get_node (previously defined locally in run_tests) to avatools.py and rename it get_ava_p2p_interface
  • initialize the nodeid attribute in AvaP2PInterface.__init__ instead of monkey-patching the object after instantiation. This is a request from the mypy linter, which raised an error because "AvaP2PInterface has no attribute nodeid" when assigning a nodeid in get_ava_p2p_interface

No other code is changed. The behavior is not changed.

Test Plan

ninja check-functional

Diff Detail

Repository
rABC Bitcoin ABC
Branch
split_abc_p2p_ava
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 16007
Build 31913: Build Diffbuild-without-wallet · build-diff · build-debug · build-clang-tidy · build-clang
Build 31912: arc lint + arc unit

Event Timeline

PiRK requested review of this revision.Jun 14 2021, 16:31
PiRK retitled this revision from [est refactoring] move AvaP2PInterface to avatools.py to [test refactoring] move AvaP2PInterface to avatools.py.
PiRK edited the summary of this revision. (Show Details)

Don't add a new method. It is enough to just initialize nodeid in __init__ to solve the linter issue.

This revision is now accepted and ready to land.Jun 14 2021, 21:47