From eae43626e106624ed96398d64fb756e00db62be9 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: May 21 2020 22:22:53 +0000 Subject: find_resultrow: handle awkward section names better (#4) Issue #4 highlights an awkward section naming case in the desktop matrix, where we have sections with very similar names where one is a substring of the other. Without this change it's impossible to actually get `find_resultrow` to distinguish between the two sections. This makes it possible in two ways: by using the exact section name (unfortunately including the awkward HTML-translated bold tags...), or the differing case of the "r" character. We do this by (as with test names) trying an *exact* name match if the substring match didn't get us down to a single row, and also trying a non-normalized match if we still didn't get down to a single row. Signed-off-by: Adam Williamson --- diff --git a/src/wikitcms/page.py b/src/wikitcms/page.py index b105149..b560c48 100644 --- a/src/wikitcms/page.py +++ b/src/wikitcms/page.py @@ -277,13 +277,28 @@ class ValidationPage(Page): # try a more precise name match - e.g. "upgrade_dnf" vs. # "upgrade_dnf_encrypted" if len(rows) > 1: - rows = [ + newrows = [ r for r in rows if nrml(testcase) == nrml(r.testcase) or nrml(testcase) == nrml(r.name) or nrml(testname) == nrml(r.name) ] + if len(newrows) == 1: + rows = newrows + # also try a more precise section name match - e.g. + # "Release-blocking desktops" vs. + # "Non release-blocking desktops": + # https://pagure.io/fedora-qa/python-wikitcms/issue/4 + if len(rows) > 1: + newrows = [r for r in rows if nrml(section) == nrml(r.section)] + if len(newrows) == 1: + rows = newrows + # let's also see if non-normalized section matching helps + if len(rows) > 1: + newrows = [r for r in rows if section in r.section] + if len(newrows) == 1: + rows = newrows if not rows: raise NotFoundError("Specified row cannot be found.") if len(rows) > 1: diff --git a/tests/data/Test_Results:Fedora_32_Branched_20200322.n.0_Desktop.sections.json b/tests/data/Test_Results:Fedora_32_Branched_20200322.n.0_Desktop.sections.json new file mode 100644 index 0000000..875cd68 --- /dev/null +++ b/tests/data/Test_Results:Fedora_32_Branched_20200322.n.0_Desktop.sections.json @@ -0,0 +1,112 @@ +[ + { + "toclevel": 1, + "level": "2", + "line": "Which tests to run", + "number": "1", + "index": "T-1", + "fromtitle": "Template:Release_validation_instructions", + "byteoffset": null, + "anchor": "Which_tests_to_run" + }, + { + "toclevel": 1, + "level": "2", + "line": "How to test", + "number": "2", + "index": "T-2", + "fromtitle": "Template:Release_validation_instructions", + "byteoffset": null, + "anchor": "How_to_test" + }, + { + "toclevel": 1, + "level": "2", + "line": "Results summary page", + "number": "3", + "index": "T-3", + "fromtitle": "Template:Release_validation_instructions", + "byteoffset": null, + "anchor": "Results_summary_page" + }, + { + "toclevel": 1, + "level": "2", + "line": "Add, Modify or Remove a Test Case", + "number": "4", + "index": "T-4", + "fromtitle": "Template:Release_validation_instructions", + "byteoffset": null, + "anchor": "Add.2C_Modify_or_Remove_a_Test_Case" + }, + { + "toclevel": 1, + "level": "2", + "line": "Key", + "number": "5", + "index": "T-5", + "fromtitle": "Template:Release_validation_instructions", + "byteoffset": null, + "anchor": "Key" + }, + { + "toclevel": 1, + "level": "2", + "line": "Test Matrix", + "number": "6", + "index": "1", + "fromtitle": "Test_Results:Fedora_32_Branched_20200322.n.0_Desktop", + "byteoffset": 130, + "anchor": "Test_Matrix" + }, + { + "toclevel": 2, + "level": "4", + "line": "Release-blocking desktops: x86 / x86_64", + "number": "6.1", + "index": "2", + "fromtitle": "Test_Results:Fedora_32_Branched_20200322.n.0_Desktop", + "byteoffset": 169, + "anchor": "Release-blocking_desktops:_x86_.2F_x86_64" + }, + { + "toclevel": 2, + "level": "4", + "line": "Release-blocking desktops: ARM", + "number": "6.2", + "index": "3", + "fromtitle": "Test_Results:Fedora_32_Branched_20200322.n.0_Desktop", + "byteoffset": 2012, + "anchor": "Release-blocking_desktops:_ARM" + }, + { + "toclevel": 2, + "level": "4", + "line": "Non release-blocking desktops: x86 / x86_64", + "number": "6.3", + "index": "4", + "fromtitle": "Test_Results:Fedora_32_Branched_20200322.n.0_Desktop", + "byteoffset": 3392, + "anchor": "Non_release-blocking_desktops:_x86_.2F_x86_64" + }, + { + "toclevel": 2, + "level": "4", + "line": "Non release-blocking desktops: ARM", + "number": "6.4", + "index": "5", + "fromtitle": "Test_Results:Fedora_32_Branched_20200322.n.0_Desktop", + "byteoffset": 6755, + "anchor": "Non_release-blocking_desktops:_ARM" + }, + { + "toclevel": 2, + "level": "4", + "line": "Sugar (non-blocking, all arches)", + "number": "6.5", + "index": "6", + "fromtitle": "Test_Results:Fedora_32_Branched_20200322.n.0_Desktop", + "byteoffset": 10404, + "anchor": "Sugar_.28non-blocking.2C_all_arches.29" + } +] diff --git a/tests/data/Test_Results:Fedora_32_Branched_20200322.n.0_Desktop.txt b/tests/data/Test_Results:Fedora_32_Branched_20200322.n.0_Desktop.txt new file mode 100644 index 0000000..630ecaf --- /dev/null +++ b/tests/data/Test_Results:Fedora_32_Branched_20200322.n.0_Desktop.txt @@ -0,0 +1,558 @@ +{{Release_validation_instructions|testtype=Desktop|release=32|milestone=Branched|compose=|date=20200322.n.0}} + +{{anchor|results}} +== '''Test Matrix''' == + + +==== Release-blocking desktops: '''x86 / x86_64''' ==== + +{| class="wikitable sortable mw-collapsible" width=100% +! Milestone !! Test Case !! [[Workstation]] !! [[KDE]] +|- +| Basic +| [[QA:Testcase_desktop_browser]] +| {{result|pass|tablepc}} +| {{result|pass|coconut|bot=true}} +|- +| Basic +| [[QA:Testcase_desktop_terminal]] +| {{result|pass|tablepc}} +| {{result|pass|coconut|bot=true}} +|- +| Beta +| [[QA:Testcase_desktop_login]] +| {{result|pass|tablepc}} +| {{result|none}} +|- +| Beta +| [[QA:Testcase_audio_basic]] +| {{result|pass|tablepc}} +| {{result|none}} +|- +| Beta +| [[QA:Testcase_desktop_panel_basic]] +| {{result|pass|tablepc}} +| {{result|none}} +|- +| Beta +| [[QA:Testcase_desktop_automount]] +| {{result|pass|tablepc}} +| {{result|none}} +|- +| Beta +| [[QA:Testcase_workstation_core_applications]] +| {{result|none}} +| style="background:lightgrey;"| +|- +| Beta +| [[QA:Testcase_desktop_update_graphical]] +| {{result|none}} +| {{result|pass|coconut|bot=true}} +|- +| Beta +| [[QA:Testcase_Printing_New_Printer|QA:Testcase_Printing_New_Printer (real printer)]] +| {{result|pass|nielsenb}}{{result|pass|tablepc}} +| {{result|pass|nielsenb}} +|- +| Beta +| [[QA:Testcase_Printing_New_Printer|QA:Testcase_Printing_New_Printer (virtual printer)]] +| {{result|none}} +| {{result|pass|coconut|bot=true}} +|- +| Final +| [[QA:Testcase_desktop_update_notification]] +| {{result|pass|tablepc}} +| {{result|none}} +|- +| Final +| [[QA:Testcase_desktop_error_checks]] +| {{result|none}} +| {{result|none}} +|- +| Final +| [[QA:Testcase_desktop_menus]] +| {{result|none}} +| {{result|none}} +|- +| Final +| [[QA:Testcase_desktop_panel_advanced]] +| {{result|pass|tablepc}} +| {{result|none}} +|- +| Final +| [[QA:Testcase_desktop_keyring]] +| {{result|none}} +| {{result|none}} +|- +| Optional +| [[QA:Testcase_workstation_theming]] +| {{result|none}} +| style="background:lightgrey;"| +|- +|} + + +==== Release-blocking desktops: '''ARM''' ==== + +{| class="wikitable sortable mw-collapsible" width=100% +! Milestone !! Test Case !! [[Workstation]] +|- +| Basic +| [[QA:Testcase_desktop_browser]] +| {{result|pass|pwhalen}} +|- +| Basic +| [[QA:Testcase_desktop_terminal]] +| {{result|pass|pwhalen}} +|- +| Beta +| [[QA:Testcase_desktop_login]] +| {{result|pass|pwhalen}} +|- +| Beta +| [[QA:Testcase_audio_basic]] +| {{result|none}} +|- +| Beta +| [[QA:Testcase_desktop_panel_basic]] +| {{result|pass|pwhalen}} +|- +| Beta +| [[QA:Testcase_desktop_automount]] +| {{result|none}} +|- +| Beta +| [[QA:Testcase_workstation_core_applications]] +| {{result|none}} +|- +| Beta +| [[QA:Testcase_desktop_update_graphical]] +| {{result|none}} +|- +| Beta +| [[QA:Testcase_Printing_New_Printer|QA:Testcase_Printing_New_Printer (real printer)]] +| {{result|none}} +|- +| Beta +| [[QA:Testcase_Printing_New_Printer|QA:Testcase_Printing_New_Printer (virtual printer)]] +| {{result|none}} +|- +| Final +| [[QA:Testcase_desktop_update_notification]] +| {{result|pass|pwhalen}} +|- +| Final +| [[QA:Testcase_desktop_error_checks]] +| {{result|pass|pwhalen}} +|- +| Final +| [[QA:Testcase_desktop_menus]] +| {{result|none}} +|- +| Final +| [[QA:Testcase_desktop_panel_advanced]] +| {{result|none}} +|- +| Final +| [[QA:Testcase_desktop_keyring]] +| {{result|none}} +|- +| Optional +| [[QA:Testcase_workstation_theming]] +| {{result|none}} +|- +|} + + +==== Non release-blocking desktops: '''x86 / x86_64''' ==== + +{| class="wikitable sortable mw-collapsible" width=100% +! Milestone !! Test Case !! [[Xfce]] !! [[LXQt_SIG|LXQt]] !! [[LXDE]] !! MATE !! Cinnamon !! GNOME Classic !! Silverblue +|- +| Basic +| [[QA:Testcase_desktop_browser]] +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|pass|coconut|bot=true}} +|- +| Basic +| [[QA:Testcase_desktop_terminal]] +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|pass|coconut|bot=true}} +|- +| Beta +| [[QA:Testcase_desktop_login]] +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +|- +| Beta +| [[QA:Testcase_audio_basic]] +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +|- +| Beta +| [[QA:Testcase_desktop_panel_basic]] +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +|- +| Beta +| [[QA:Testcase_desktop_automount]] +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +|- +| Beta +| [[QA:Testcase_workstation_core_applications]] +| style="background:lightgrey;"| +| style="background:lightgrey;"| +| style="background:lightgrey;"| +| style="background:lightgrey;"| +| style="background:lightgrey;"| +| style="background:lightgrey;"| +| {{result|none}} +|- +| Beta +| [[QA:Testcase_desktop_update_graphical]] +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +|- +| Beta +| [[QA:Testcase_Printing_New_Printer|QA:Testcase_Printing_New_Printer (real printer)]] +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +|- +| Beta +| [[QA:Testcase_Printing_New_Printer|QA:Testcase_Printing_New_Printer (virtual printer)]] +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +|- +| Final +| [[QA:Testcase_desktop_update_notification]] +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +|- +| Final +| [[QA:Testcase_desktop_error_checks]] +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +|- +| Final +| [[QA:Testcase_desktop_menus]] +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +|- +| Final +| [[QA:Testcase_desktop_panel_advanced]] +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +|- +| Final +| [[QA:Testcase_desktop_keyring]] +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +|- +| Optional +| [[QA:Testcase_workstation_theming]] +| style="background:lightgrey;"| +| style="background:lightgrey;"| +| style="background:lightgrey;"| +| style="background:lightgrey;"| +| style="background:lightgrey;"| +| style="background:lightgrey;"| +| {{result|none}} +|- +|} + + +==== Non release-blocking desktops: '''ARM''' ==== + +{| class="wikitable sortable mw-collapsible" width=100% +! Milestone !! Test Case !! [[KDE]] !! [[Xfce]] !! [[LXQt_SIG|LXQt]] !! [[LXDE]] !! MATE !! Cinnamon !! GNOME Classic !! Silverblue +|- +| Basic +| [[QA:Testcase_desktop_browser]] +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +|- +| Basic +| [[QA:Testcase_desktop_terminal]] +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +|- +| Beta +| [[QA:Testcase_desktop_login]] +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +|- +| Beta +| [[QA:Testcase_audio_basic]] +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +|- +| Beta +| [[QA:Testcase_desktop_panel_basic]] +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +|- +| Beta +| [[QA:Testcase_desktop_automount]] +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +|- +| Beta +| [[QA:Testcase_workstation_core_applications]] +| style="background:lightgrey;"| +| style="background:lightgrey;"| +| style="background:lightgrey;"| +| style="background:lightgrey;"| +| style="background:lightgrey;"| +| style="background:lightgrey;"| +| style="background:lightgrey;"| +| {{result|none}} +|- +| Beta +| [[QA:Testcase_desktop_update_graphical]] +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +|- +| Beta +| [[QA:Testcase_Printing_New_Printer|QA:Testcase_Printing_New_Printer (real printer)]] +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +|- +| Beta +| [[QA:Testcase_Printing_New_Printer|QA:Testcase_Printing_New_Printer (virtual printer)]] +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +|- +| Final +| [[QA:Testcase_desktop_update_notification]] +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +|- +| Final +| [[QA:Testcase_desktop_error_checks]] +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +|- +| Final +| [[QA:Testcase_desktop_menus]] +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +|- +| Final +| [[QA:Testcase_desktop_panel_advanced]] +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +|- +| Final +| [[QA:Testcase_desktop_keyring]] +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +| {{result|none}} +|- +| Optional +| [[QA:Testcase_workstation_theming]] +| style="background:lightgrey;"| +| style="background:lightgrey;"| +| style="background:lightgrey;"| +| style="background:lightgrey;"| +| style="background:lightgrey;"| +| style="background:lightgrey;"| +| style="background:lightgrey;"| +| {{result|none}} +|- +|} + + +==== Sugar (non-blocking, all arches) ==== + +{{admon/note|Sugar test cases|The Sugar desktop differs significantly from a typical desktop, so it gets its own test cases. At present these live [http://wiki.sugarlabs.org/go/Fedora/Sugar_test_cases on the Sugar wiki].}} + +{| class="wikitable sortable mw-collapsible" width=100% +! Test Case !! x86 !! ARM +|- +| QA:Testcase_[http://wiki.sugarlabs.org/go/Fedora/Sugar_test_cases#1_-_SoaS_boots_to_the_.28name.29_selection_screen. SoaS boots to the (name) selection screen] +| {{result|none}} +| {{result|none}} +|- +|QA:Testcase_[http://wiki.sugarlabs.org/go/Fedora/Sugar_test_cases#2_-_SoaS_installed_to_hard_disk_with_liveinst_from_root_terminal.2C SoaS installed to hard disk with {{Code|liveinst}} from root terminal] +| {{result|none}} +| {{result|none}} +|- +|QA:Testcase_[http://wiki.sugarlabs.org/go/Fedora/Sugar_test_cases#3_-_Jabber.sugarlabs.org_should_connect_and_display_XO_.22Buddies.22 Jabber.sugarlabs.org should connect and display XO "Buddies"] +| {{result|none}} +| {{result|none}} +|- +|QA:Testcase_[http://wiki.sugarlabs.org/go/Fedora/Sugar_test_cases#4_-_When_a_USB_storage_device_is_inserted.2C_it_should_show_up_in_the_Frame. When a USB storage device is inserted, it should show up in the Frame] +| {{result|none}} +| {{result|none}} +|- +|QA:Testcase_[http://wiki.sugarlabs.org/go/Fedora/Sugar_test_cases#5_-Functions_in_My_Settings_.28Sugar_control_panel.29. Functions in My Settings (Sugar control panel)] +| {{result|none}} +| {{result|none}} +|- +|QA:Testcase_[http://wiki.sugarlabs.org/go/Fedora/Sugar_test_cases#6_-_Applications_in_the_Home_Screen Applications in the ''Home Screen''] +| {{result|none}} +| {{result|none}} +|- +|QA:Testcase_[http://wiki.sugarlabs.org/go/Fedora/Sugar_test_cases#7_-Sugar-desktop_installed_in_another_Desktop Sugar-desktop installed in another Desktop] +| {{result|none}} +| {{result|none}} +|- +|} + + +[[Category:Desktop_validation_testing]] +{{#if:20200322.n.0|[[Category:Fedora_32_Nightly_Test_Results|Desktop]]|[[Category:Fedora_32_Branched_Test_Results|Desktop]]}} diff --git a/tests/test_page.py b/tests/test_page.py index 41c138c..46042f1 100644 --- a/tests/test_page.py +++ b/tests/test_page.py @@ -382,6 +382,25 @@ class TestValidationPages: # raise TooManyError or anything row = page.find_resultrow(testcase="QA:Testcase_freeipa_replication") assert row.testcase == "QA:Testcase_freeipa_replication" + # similar case for section names, see + # https://pagure.io/fedora-qa/python-wikitcms/issue/4 + page = wikitcms.page.NightlyPage(self.site, "32", "Desktop", "Branched", "20200322.n.0") + row = page.find_resultrow( + testcase="QA:Testcase_audio_basic", + section="Release-blocking desktops: x86 / x86_64", + ) + assert row.testcase == "QA:Testcase_audio_basic" + assert row.secid == "2" + assert row.section == "Release-blocking desktops: x86 / x86_64" + # similar, but relying on non-normalized rather than exact + # name matching: as we use a lower-case "r" we expect to find + # the row in the "Non release-blocking" section + row = page.find_resultrow( + testcase="QA:Testcase_audio_basic", section="release-blocking desktops: x86" + ) + assert row.testcase == "QA:Testcase_audio_basic" + assert row.secid == "4" + assert row.section == "Non release-blocking desktops: x86 / x86_64" @mock.patch("mwclient.page.Page.save", autospec=True) def test_update_current(self, fakesave):