community.general
community.general copied to clipboard
fix test helper handling of rc
SUMMARY
Handle rc != 0 when check_rc = True
ISSUE TYPE
- Test Pull Request
COMPONENT NAME
ADDITIONAL INFORMATION
Hmm, there are a lot of failing unit tests. TypeError: side_effect() takes 0 positional arguments but 1 was given seems to indicate that side_effect() should accept the self parameter.
Looking at it again, I'm also not sure this really does what you think it does. My guess is that for every time someone calls module.run_command(), side_effect() is called once (and thus now returns a generator instead of the actual results).
The test ansible-test sanity --test pylint [explain] failed with 1 error:
tests/unit/plugins/modules/helper.py:85:12: use-yield-from: Use 'yield from' directly instead of yielding each element one by one
The test ansible-test sanity --test pylint [explain] failed with 1 error:
tests/unit/plugins/modules/helper.py:85:12: use-yield-from: Use 'yield from' directly instead of yielding each element one by one
Regarding the pylint errors, use test/sanity/ignore-2.1[78].txt to ignore them like in some other cases:
tests/sanity/ignore-2.18.txt:plugins/module_utils/univention_umc.py pylint:use-yield-from # suggested construct does not work with Python 2
tests/sanity/ignore-2.18.txt:tests/unit/compat/mock.py pylint:use-yield-from # suggested construct does not work with Python 2
tests/sanity/ignore-2.17.txt:plugins/module_utils/univention_umc.py pylint:use-yield-from # suggested construct does not work with Python 2
tests/sanity/ignore-2.17.txt:tests/unit/compat/mock.py pylint:use-yield-from # suggested construct does not work with Python 2
The test ansible-test sanity --test ignores [explain] failed with 1 error:
tests/sanity/ignore-2.17.txt:14:38: Sanity test 'yield-from' does not exist
The test ansible-test sanity --test ignores [explain] failed with 1 error:
tests/sanity/ignore-2.18.txt:14:38: Sanity test 'yield-from' does not exist
The test ansible-test sanity --test pylint [explain] failed with 1 error:
tests/unit/plugins/modules/helper.py:84:12: use-yield-from: Use 'yield from' directly instead of yielding each element one by one
The test ansible-test sanity --test pylint [explain] failed with 1 error:
tests/unit/plugins/modules/helper.py:84:12: use-yield-from: Use 'yield from' directly instead of yielding each element one by one
Backport to stable-8: 💔 cherry-picking failed — conflicts found
❌ Failed to cleanly apply da2c87ce0d3546edc068137d0a1279605bc377a4 on top of patchback/backports/stable-8/da2c87ce0d3546edc068137d0a1279605bc377a4/pr-8387
Backporting merged PR #8387 into main
- Ensure you have a local repo clone of your fork. Unless you cloned it
from the upstream, this would be your
originremote. - Make sure you have an upstream repo added as a remote too. In these
instructions you'll refer to it by the name
upstream. If you don't have it, here's how you can add it:$ git remote add upstream https://github.com/ansible-collections/community.general.git - Ensure you have the latest copy of upstream and prepare a branch
that will hold the backported code:
$ git fetch upstream $ git checkout -b patchback/backports/stable-8/da2c87ce0d3546edc068137d0a1279605bc377a4/pr-8387 upstream/stable-8 - Now, cherry-pick PR #8387 contents into that branch:
If it'll yell at you with something like$ git cherry-pick -x da2c87ce0d3546edc068137d0a1279605bc377a4fatal: Commit da2c87ce0d3546edc068137d0a1279605bc377a4 is a merge but no -m option was given., add-m 1as follows instead:$ git cherry-pick -m1 -x da2c87ce0d3546edc068137d0a1279605bc377a4 - At this point, you'll probably encounter some merge conflicts. You must resolve them in to preserve the patch from PR #8387 as close to the original as possible.
- Push this branch to your fork on GitHub:
$ git push origin patchback/backports/stable-8/da2c87ce0d3546edc068137d0a1279605bc377a4/pr-8387 - Create a PR, ensure that the CI is green. If it's not — update it so that the tests and any other checks pass. This is it! Now relax and wait for the maintainers to process your pull request when they have some cycles to do reviews. Don't worry — they'll tell you if any improvements are necessary when the time comes!
🤖 @patchback I'm built with octomachinery and my source is open — https://github.com/sanitizers/patchback-github-app.
Backport to stable-9: 💚 backport PR created
✅ Backport PR branch: patchback/backports/stable-9/da2c87ce0d3546edc068137d0a1279605bc377a4/pr-8387
Backported as https://github.com/ansible-collections/community.general/pull/8414
🤖 @patchback I'm built with octomachinery and my source is open — https://github.com/sanitizers/patchback-github-app.
@russoz thanks for implementing this!