tests: Rewrite with unittest the select/socket tests that use UDP.#19333
Open
dpgeorge wants to merge 2 commits into
Open
tests: Rewrite with unittest the select/socket tests that use UDP.#19333dpgeorge wants to merge 2 commits into
dpgeorge wants to merge 2 commits into
Conversation
Three tests are rewritten using unittest, so that they don't need to be run under CPython to get the expected output. Because running under CPython requires port 8000 to be available, which it may not (at least for tests in the extmod directory having a port available should not be a requirement). Signed-off-by: Damien George <damien@micropython.org>
Similar to the parent commit, this means CPython doesn't need to run to get the expected output, and means port 8000 doesn't need to be available. Signed-off-by: Damien George <damien@micropython.org>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #19333 +/- ##
=======================================
Coverage 98.49% 98.49%
=======================================
Files 176 176
Lines 22911 22911
=======================================
Hits 22566 22566
Misses 345 345 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Octoprobe PR report
FailuresGroup: run-tests.py --test-dirs=extmod_hardware
Group: run-tests.py --test-dirs=extmod_hardware --emit-native
Group: run-tests.py
Group: run-tests.py --via-mpy --emit native
Group: run-tests.py --via-mpy
|
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.
Summary
Three tests are rewritten using unittest, so that they don't need to be run under CPython to get the expected output. Because running under CPython requires port 8000 to be available, which it may not (at least for tests in the extmod directory having a port available should not be a requirement).
And one test had a .py.exp file added, for the same reason (so CPython doesn't need to be run).
This was motivated by some failures in Octoprobe, where tests failed because CPython could not run the test to get the expected output, because port 8000 was in use (the tests otherwise run on target boards, not the host micropython).
Testing
To be tested by CI, and Octoprobe.
Trade-offs and Alternatives
This gives a bit of churn, but unittest is arguably a better choice for finicky tests like these, it makes it easy to understand what it's testing, and extend it in the future.
Running the tests on local micropython executables still requires port 8000 to be available, but that's a harder problem to solve, and isn't an issue with Octoprobe (which only tests hardware targets).
Generative AI
Not used.