Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
Signed-off-by: Xiangce Liu <xiangceliu@redhat.com>

rh-pre-commit.version: 2.3.1
rh-pre-commit.check-secrets: ENABLED
  • Loading branch information
xiangce committed Sep 29, 2024
1 parent 1cc69d0 commit 535f19f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
run: |
pip install urllib3
pip install -e .[testing]
pytest
pytest --log-cli-level=WARN
python26-test:

Expand Down Expand Up @@ -112,7 +112,7 @@ jobs:
export PATH=$PATH:/github/home/.local/bin
pip install --user -e .[testing] -f ./pips/slave26/pip_packages
export PYTHONPATH=${PYTHONPATH}:./../collections_module
pytest
pytest --log-cli-level=WARN
docs-test:

Expand Down
11 changes: 9 additions & 2 deletions insights/parsers/uname.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,10 +414,16 @@ def _best_lv_release(self, other):
o_release_parts = other._lv_release.vstring.split(".")
is_s_with_dist = s_release_parts[-1].startswith(dist_opts)
is_o_with_dist = o_release_parts[-1].startswith(dist_opts)
import logging
logger = logging.getLogger(__name__)
if not (is_s_with_dist ^ is_o_with_dist):
return self._lv_release, other._lv_release
import warnings
warnings.warn('Comparison of distribution part will be ingored.')
try:
import warnings
warnings.warn('Comparison of distribution part will be ignored.')
except Exception as ex:
print(str(ex))
logger.warning('_best_lv_release: after warnings')
s_release = (
self._lv_release.vstring if not is_s_with_dist
else pad_release(".".join(s_release_parts[:-1]), len(s_release_parts))
Expand Down Expand Up @@ -586,6 +592,7 @@ def fixed_by(self, *fixes, **kwargs):
# If there is a fix in your kernel release stream
# See if you are fixed by it
for i, fixed in enumerate(fix_unames):
print('FIXED BY:', self._rel_maj, fixed._rel_maj)
if self._rel_maj == fixed._rel_maj:
if self._less_than(fixed):
return fix_kernels[i:]
Expand Down
6 changes: 4 additions & 2 deletions insights/tests/parsers/test_uname.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def test_fixed_by():
def test_fixed_by_warning():
# For all remaining tests, cause the comparation warnings
# to always be caught, and ignore other warnings.
warning_msg = "Comparison of distribution part will be ingored"
warning_msg = "Comparison of distribution part will be ignored."
warnings.simplefilter("ignore")
warnings.filterwarnings("always", message=warning_msg)
with warnings.catch_warnings(record=True) as w:
Expand All @@ -253,11 +253,13 @@ def test_fixed_by_warning():
assert [] == u.fixed_by('2.6.32-220.1.el6', '2.6.32-504.el6')
assert len(w) == 0

print('---------------------------------')
# fixes without distribution part
assert [] == u.fixed_by('2.6.32-504')
assert len(w) == 1
print('---------------------------------')

# fixes only has kernel version part
# frnings.warn('Comparison of distribution part will be ingored.')ixes only has kernel version part
assert [] == u.fixed_by('2.6.32-')
assert len(w) == 2

Expand Down

0 comments on commit 535f19f

Please sign in to comment.