Migrate all Integration Tests to Pytest and Refactor Test Framework#794
Draft
moisesPompilio wants to merge 25 commits intogetfloresta:masterfrom
Draft
Migrate all Integration Tests to Pytest and Refactor Test Framework#794moisesPompilio wants to merge 25 commits intogetfloresta:masterfrom
moisesPompilio wants to merge 25 commits intogetfloresta:masterfrom
Conversation
Collaborator
Author
|
This PR is not completely ready because some points in the get_txout test still need to be fixed, and the commit messages need improvement. However, you can already get a preview of how the tests look with pytest and how much faster test execution is now. cc: @joaozinhom |
Introduce pytest as the new testing framework to simplify and enhance the way tests are written and executed. Pytest facilitates the creation of reusable functions and fixtures, making it easier to manage and instantiate nodes dynamically. It also provides built-in assertion functions and a robust test runner. co-authored-by: joaozinhom <joaozinhom@users.noreply.github.com>
Introduce multithread support for pytest in the functional tests, enabling tests to run in parallel with a default of 4 workers. To ensure proper isolation and avoid conflicts between tests running simultaneously, the `/data` directory for nodes is now generated dynamically based on the name of the test being executed. This adjustment leverages the `request.node.name` attribute to create unique data directories for each test. co-authored-by: joaozinhom <joaozinhom@users.noreply.github.com>
…unner.py Migrated the Electrum example test to use pytest, simplifying the test structure. Removed the requirement for all tests to be listed in test_runner.py, allowing tests to be run independently with pytest. co-authored-by: joaozinhom <joaozinhom@users.noreply.github.com>
…work - Merged the addnode_v1 and addnode_v2 tests into a single pytest file `addnode.py`. - Introduced the `TestAddNode` class to encapsulate the tests. - Added `test_add_node_v1` and `test_add_node_v2` methods to handle v1 and v2 transport protocol tests, respectively.
…hain test to pytest - Added the `florestad_utreexod` fixture to simplify tests requiring both a `florestad` and `utreexod` node. The fixture automatically creates, starts, and connects the nodes, making them ready for testing. - Migrated the `reorg_chain` test to pytest, utilizing the new `florestad_utreexod` fixture for node setup.
…cy test framework
…egacy test framework
…gacy test framework
…acy test framework
…ng and synchronization
…nd refactor daemon setup methods
28fe662 to
4d284fa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description and Notes
This PR migrates all existing integration tests to use the pytest framework, removing the old custom
test_runnerwhich is no longer necessary. TheFlorestaTestFrameworkhas been significantly refactored to align with pytest conventions; custom assertion methods and main entry points have been removed since pytest handles these natively.Key improvements include:
connect: A new helper function has been introduced to automatically connect all nodes to each other in tests, simplifying test code by eliminating repetitive peer connection setup.FlorestaTestFramework.Note: This PR depends on PR #742 and should be merged after it.
Close: #783
How to verify the changes you have done?
connecthelper function simplifies node connection setup and reduces boilerplate code.