Repository navigation
Run pytest unless SKIP_PYTEST=1; fix lint test collection from repo root - #57
Merged
Merged
Conversation
run-regression.sh only ran pytest when SCENARIOS was unset or listed "pytest", so SCENARIOS="mc_gps baseline" printed 'skipping pytest'. pytest now runs unless SKIP_PYTEST=1 (reg_pytest_decision), the skip message names the reason, and a pytest.txt with no 'N passed' line no longer aborts the script under pipefail before the report is written. pytest ros2_ws/src failed collection with 6 'import file mismatch' errors: test_flake8/test_pep257/test_copyright share basenames across packages and prepend import mode collides. A root pytest.ini sets --import-mode=importlib. The lint tests now lint their own package from any cwd, importorskip the ament linters with a reason, mark existing flake8/pep257 findings strict xfail, and test_copyright checks the SPDX AGPL-3.0-only header directly (ament_copyright has no AGPL license).
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.
Two small fixes found during the ODL-86 work. No flight, gate, OpenVINS, EKF2, world or profile change.
1.
run-regression.shskipped pytest whenSCENARIOSwas setregression_20261124_153609ranSCENARIOS="mc_gps baseline"and printed[REG] skipping pytest. Root cause: withSCENARIOSset, pytest only ran if the wordpytestwas listed. That contradicts the documentedSKIP_PYTEST=1 SCENARIOS=<one>usage, which implies pytest runs by default.SKIP_PYTEST=1(reg_pytest_decisioninregression-lib.sh).SCENARIOS=pyteststill means pytest only.skipping pytest (SKIP_PYTEST=1).pytest.txthad noN passedline,grep | head | awkunderpipefail+set -eaborted the run beforepytest.jsonand the report were written. That is fixed too.test_regression_harness.pycover the decision function, pytest running withSCENARIOS=mc_gps/mc_gps pytest/pytest(and whether it flies), and the explicit skip reason.2. Six lint test collection errors from
pytest ros2_ws/srcRoot cause: the ament linters are installed in the dev image, so missing deps were not the cause.
test_flake8.py,test_pep257.pyandtest_copyright.pyexist with the same basenames in drone_mission_manager, drone_perception and drone_telemetry, and the test directories have no__init__.py. pytest's defaultprependimport mode imports them all under one module name, so the perception and telemetry copies failed with "import file mismatch" (3 + 3 errors).pytest.inisets--import-mode=importliband registers the lint markers. colcon runs each package from its own directory, so it does not use this file.argv=[]/['.', 'test']), so from the root they linted the whole checkout. They now lint their own package, found from__file__.pytest.importorskip) instead of passing silently.xfailwith a reason, so they will flag once the package is clean.ament_copyrighthas no AGPL license in its list, so it reportedlicense=<unknown>for every file and could never pass.test_copyrightnow checks the SPDXAGPL-3.0-onlyand copyright lines directly, and it passes.Checks
pytest ros2_ws/srcfrom the root: 380 passed, 6 xfailed, 0 collection errors.SCENARIOS=pytest ./scripts/run-regression.sh: PASS, 373 passed.