-
Notifications
You must be signed in to change notification settings - Fork 84
Feat(functional): Add pytest #742
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
6260aea to
b2a5303
Compare
b2a5303 to
a342d5c
Compare
Thanks for letting me know about this detail, I already made the change. |
|
@moisesPompilio Do you think that we could remove this nix shell on #716 ? |
Yes, I did that in this commit: 7d2d02f |
86cb2eb to
61fcef8
Compare
|
I did the rebase and added the logger part to be used in pytest that was missing, so we have the logger files like in the test without pytest. However when a pytest test fails it already displays the failure in the terminal which saves time searching the log file. Besides that, now we have logger levels. In this case the default level is debug. |
6692ee0 to
c97ae29
Compare
e4084ba to
9feeaf8
Compare
|
Needs rebase |
9feeaf8 to
32fb3e9
Compare
|
32fb3e9 Rebase done |
42c63a9 fix: cleanup test directories before running tests - Keep unconditional /data cleanup at start - Make /logs cleanup conditional on --preserve-data-dir flag (Eduardo Augusto) Pull request description: Related to #760 (mitigation) Keep unconditional /data cleanup at start Make /logs cleanup conditional on --preserve-data-dir flag Prevents reusing old log state between test runs Description and Notes Currently, the cleanup of /logs directory happens at the END of test execution and only if tests pass. This causes: Failed tests leave corrupted log state for next run Tests may fail when run multiple times without manual cleanup This PR provides a temporary mitigation by making /logs cleanup conditional on the --preserve-data-dir flag, while keeping /data unconditionally cleaned at start. Note: This is a partial fix. Complete resolution will come in a follow-up PR after #742 is merged, where cleanup logic will be migrated to the Python runner for better control over test data management. How to verify the changes you have done? # Test 1: Run tests multiple times ./tests/prepare.sh ./tests/run.sh ./tests/run.sh # Should work without manual cleanup # Test 2: Preserve logs for debugging ./tests/run.sh --preserve-data-dir ls -la $FLORESTA_TEMP_DIR/logs # Logs preserved Next Steps After #742 is merged, I plan to submit a follow-up PR to: Migrate cleanup logic to the Python test runner Provide more granular control over test data management Fully resolve #760 Contributor Checklist I've followed the [contribution guidelines](https://github.com/vinteumorg/Floresta/blob/master/CONTRIBUTING.md) I've verified one of the following: Ran just pcc (skipped - changes are bash-only, validated manually) Ran just lint-features '-- -D warnings' && cargo test --release (not applicable) Confirmed CI passed on my fork (will run after PR creation) I've linked any related issue(s) in the sections above Manual validation performed: ✅ Bash syntax check (bash -n) ✅ Logic tested with simulations ✅ --preserve-data-dir flag tested ✅ Consecutive test runs verified ACKs for top commit: moisesPompilio: ACK 42c63a9 jaoleal: ACK 42c63a9 Tree-SHA512: b3c9f62d4ce612e7231748aeae7352cb89c725243e69251879291af9ca1083a5ca2774405034394df39c407bd0005d87950c79b76740f4442be5e842006bb458
|
Needs rebase again |
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>
…test_runner.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>
32fb3e9 to
165b340
Compare
|
165b340 Rebase done |


Description and Notes
Pytest, a widely used Python testing framework, has been integrated into the functional test suite. Pytest simplifies test creation, execution, and management, making it easier to scale and maintain the test suite as it grows.
run.shscript was updated to support running both the new pytest-based functional tests and the existing, non-migrated tests.--pytestinrun.shto run only the pytest-based tests, or--test-runnerto execute the legacy test runner.Note: This PR depends on the changes from PR #731 to function properly.
How to verify the changes you have done?
run.shand confirm that both the pytest-based and legacy functional tests are executed.--pytestflag withrun.shto run only pytest-based tests and verify expected output and results.--test-runnerflag to run only legacy functional tests.