Tweak FMW env special handling to return real column names
All checks were successful
CI via Tox / tox (pull_request) Successful in 1m36s
AI Code Review / ai-review (pull_request_target) Successful in 22s

The placeholder names aren't good enough - we have to substitute
with the *real* names, as best we can (we'll use fedfind.helpers
for this, which should pretty much always be in sync with
the CurrentFedoraVersion template; we can't easily use the
template here because Past Adam foolishly didn't put the wiki
object in this function's scope).

This substitution is actually rarely used anyway; it'll only be
used if you instantiate Template:Installation test matrix rather
than an actual result page, and the only thing that does that is
the fedora_openqa `checkwiki` script (for...reasons). Added a
note explaining this.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2026-04-09 17:28:02 -07:00
commit e168f30282
2 changed files with 19 additions and 10 deletions

View file

@ -23,6 +23,8 @@ with results."""
from collections import OrderedDict
import re
import fedfind.helpers
import wikitcms.helpers
# These are used by multiple functions, so let's share them.
@ -158,13 +160,17 @@ def find_resultrows(text, section="", secid=0, statuses=None, transferred=True):
except ValueError:
pass
# special handling for the weird media writer cols
# NOTE: this is only relevant when using the matrix
# template pages - in real result pages we get the
# substituted text
if "safesubst" in newcol and "CurrentFedoraVersion" in newcol:
curr = fedfind.helpers.get_current_release()
if "- 1" in newcol:
newcol = "Fedora CurrentFedoraVersion - 1"
newcol = f"Fedora {str(curr - 1)}"
elif "+ 1" in newcol:
newcol = "Fedora CurrentFedoraVersion + 1"
newcol = f"Fedora {str(curr + 1)}"
else:
newcol = "Fedora CurrentFedoraVersion"
newcol = f"Fedora {str(curr)}"
try:
newcol = newcol.split("|")[1]
except IndexError:

View file

@ -24,6 +24,8 @@
"""Tests for result.py."""
from unittest import mock
import wikitcms.result as rs
@ -720,7 +722,8 @@ The explanation of test case priority is available at [[QA:Fedora_12_Install_Tes
{"x86_64": 1, "aarch64": 1},
)
def test_findresultrows_mediawriter(self):
@mock.patch("fedfind.helpers.get_current_release", return_value=43)
def test_findresultrows_mediawriter(self, fakecurr):
"""Test special handling in find_resultrows for the weird
media writer test columns.
"""
@ -750,18 +753,18 @@ The explanation of test case priority is available at [[QA:Fedora_12_Install_Tes
[
"Milestone",
"Test Case",
"Fedora CurrentFedoraVersion - 1",
"Fedora CurrentFedoraVersion",
"Fedora CurrentFedoraVersion + 1",
"Fedora 42",
"Fedora 43",
"Fedora 44",
"Flathub",
"Windows 10",
"Windows 11",
"macOS",
],
{
"Fedora CurrentFedoraVersion - 1": 1,
"Fedora CurrentFedoraVersion": 1,
"Fedora CurrentFedoraVersion + 1": 1,
"Fedora 42": 1,
"Fedora 43": 1,
"Fedora 44": 1,
"Flathub": 1,
"Windows 10": 1,
"Windows 11": 1,