test: relax check for Package field#592
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #592 +/- ##
=======================================
Coverage 84.54% 84.54%
=======================================
Files 104 104
Lines 21028 21028
Branches 3221 3221
=======================================
Hits 17779 17779
Misses 2809 2809
Partials 440 440 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
609c33a to
b439dcc
Compare
`test_run_report_bug_kernel_thread` might failed in a autopkgtest VM:
```
=================================== FAILURES ===================================
_____________________ T.test_run_report_bug_kernel_thread ______________________
self = <tests.integration.test_ui.T testMethod=test_run_report_bug_kernel_thread>
get_version_mock = <MagicMock name='get_version' id='130971739753504'>
@unittest.mock.patch("apport.packaging_impl.impl.get_version")
def test_run_report_bug_kernel_thread(self, get_version_mock: MagicMock) -> None:
"""run_report_bug() for a pid of a kernel thread"""
# The kernel package might not be installed in chroot environments.
# Therefore mock get_version for the kernel package.
get_version_mock.return_value = "5.15.0-33.34"
for path in glob.glob("/proc/[0-9]*/stat"):
with open(path, encoding="utf-8") as f:
proc_stat = f.read().split()
flags = int(proc_stat[8])
if flags & apport.ui.PF_KTHREAD:
pid = int(proc_stat[0])
break
else:
self.skipTest("no kernel thread found")
ui = UserInterfaceMock(["ui-test", "-f", "-P", str(pid)])
ui.present_details_response = apport.ui.Action(report=True)
ui.run_argv()
assert ui.report
kernel_package = packaging.get_kernel_package()
> self.assertEqual(
ui.report["Package"], f"{kernel_package} {get_version_mock.return_value}"
)
E AssertionError: 'linux-image-7.0.0-12-generic 5.15.0-33.34 [origin: unknown]' != 'linux-image-7.0.0-12-generic 5.15.0-33.34'
E - linux-image-7.0.0-12-generic 5.15.0-33.34 [origin: unknown]
E ? ------------------
E + linux-image-7.0.0-12-generic 5.15.0-33.34
tests/integration/test_ui.py:911: AssertionError
=============================== warnings summary ===============================
```
Bug: https://launchpad.net/bugs/2149909
b439dcc to
c21b7c6
Compare
Member
Author
|
Just rebased. |
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.
test_run_report_bug_kernel_threadmight failed in a autopkgtest VM:Bug: https://launchpad.net/bugs/2149909