tests: improve the test suite implementation #429
Merged
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.
This is the first of a series of PR to improve the test suite readability and reliability.
tests: ensure python 3.8
This version supports features that will help improving the current
implementation:
subprocess.run
Update
tests.CMakeLists.txt
to find the Python3 package.Add the
ruff.toml
file. Line lenght has been set to 100, and isort isenabled for lint.
See also
https://devguide.python.org/versions/
tests: run "ruff format tests/tools"
Run "ruff format tests/tools" and "ruff format tests/tools/run-tests"
This commit changes a lot of code
statistics:
tests/tools/accumulate.py | 166 +++++++++--
tests/tools/bash.py | 327 +++++++++++++++++++---
tests/tools/bash_linux_only.py | 42 ++-
tests/tools/basic.py | 19 +-
tests/tools/compiled.py | 463 +++++++++++++++++++++++++------
tests/tools/compiled_basic.py | 81 +++++-
tests/tools/filter.py | 51 +++-
tests/tools/parse_cobertura.py | 19 +-
tests/tools/python.py | 127 ++++++++-
tests/tools/run-tests | 6 +-
tests/tools/system_mode.py | 32 ++-
tests/tools/testbase.py | 23 +-
12 files changed, 1153 insertions(+), 203 deletions(-)
tests: run "ruff check --fix tests/tools"
Run "ruff check --fix tests/tools" and
"ruff check --fix tests/tools/run-tests"
Apply safe fixes.
tests: run "ruff check --fix --unsafe-fixes tests/tools"
Run "ruff check --fix --unsafe-fixes tests/tools" and
"ruff check --fix --unsafe-fixes tests/tools/run-tests"
Apply unsafe fixes. These are actually safe.
These are additional errors reported by ruff:
tests/tools/compiled.py:217:9: F821 Undefined name
self
tests/tools/compiled.py:321:9: E722 Do not use bare
except
tests/tools/compiled.py:685:9: F821 Undefined name
time
tests/tools/compiled.py:689:9: F821 Undefined name
time
tests/tools/system_mode.py:61:9: E722 Do not use bare
except
Most of the code change has be done automatically. Also note that some change are not optimal, but I avoided manual changes.
Since review will be very hard and you should not trust me, I suggest to @SimonKagstrom that
Only merge the first commit.
Add a commit for each of the following commands:
I used
ruff 0.3.3
but it should be ok to use a different version.Formatting the code will make future changes more easy.
As an example, I plan to change how the command line is created for
subprocess
.Currently is is a string, where arguments are concatenated together; it is terrible!