Bug 1171671 - catching wrong exception if testcase has no caseplan
Summary: catching wrong exception if testcase has no caseplan
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-nitrate
Version: 22
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
Assignee: Petr Šplíchal
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-12-08 10:53 UTC by Ales Zelinka
Modified: 2016-06-01 01:48 UTC (History)
3 users (show)

Fixed In Version: python-nitrate-1.3-1.el7
Clone Of:
Environment:
Last Closed: 2016-02-22 07:56:29 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
proposed patch (544 bytes, patch)
2016-02-04 12:03 UTC, Iveta Wiedermann
no flags Details | Diff

Description Ales Zelinka 2014-12-08 10:53:29 UTC
Description of problem:
Traceback (most recent call last):
  File "/usr/bin/tcms-plan", line 427, in <module>
    errata, general_plan)
  File "/usr/bin/tcms-plan", line 281, in create_update_plan
    testcases = set([case for case in general_plan
  File "/usr/lib/python2.6/site-packages/nitrate/mutable.py", line 184, in __iter__
    for testcase in self.testcases:
  File "/usr/lib/python2.6/site-packages/nitrate/containers.py", line 779, in __iter__
    self._items, key=lambda x: self._object.sortkey(x)):
  File "/usr/lib/python2.6/site-packages/nitrate/containers.py", line 779, in <lambda>
    self._items, key=lambda x: self._object.sortkey(x)):
  File "/usr/lib/python2.6/site-packages/nitrate/mutable.py", line 368, in sortkey
    if caseplan.testcase == testcase][0]
IndexError: list index out of range


The code is 
        try:
            caseplan = [caseplan for caseplan in self.caseplans
                    if caseplan.testcase == testcase][0]
        except KeyError:
            raise NitrateError("No CasePlan for {0} in {1} found".format(
                    testcase.identifier, self.identifier))

It should except IndexError since we're accessing an array. Or maybe a LookupError if both array and dectionary lookup might fail.

Comment 1 Jaroslav Reznik 2015-03-03 16:34:34 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 22 development cycle.
Changing version to '22'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora22

Comment 2 Iveta Wiedermann 2016-02-04 12:03:11 UTC
Created attachment 1121087 [details]
proposed patch

Exception changed from KeyError to LookupError.

Comment 3 Petr Šplíchal 2016-02-09 17:18:59 UTC
Thanks for the patch, Iveta. Merged into master:
https://github.com/psss/python-nitrate/commit/e902887

Comment 4 Fedora Update System 2016-02-10 11:51:43 UTC
python-nitrate-1.3-1.el6 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-687d19409b

Comment 5 Fedora Update System 2016-02-10 11:55:50 UTC
python-nitrate-1.3-1.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-35a106d076

Comment 6 Fedora Update System 2016-02-10 11:57:31 UTC
python-nitrate-1.3-1.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2016-2bb9364c32

Comment 7 Fedora Update System 2016-02-10 11:58:21 UTC
python-nitrate-1.3-1.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-7474e957a9

Comment 8 Petr Šplíchal 2016-02-10 12:50:22 UTC
Latest packages for testing available in the copr repository:
https://copr.fedorainfracloud.org/coprs/psss/python-nitrate/

Comment 9 Fedora Update System 2016-02-10 17:20:01 UTC
python-nitrate-1.3-1.el6 has been pushed to the Fedora EPEL 6 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-687d19409b

Comment 10 Fedora Update System 2016-02-10 18:22:36 UTC
python-nitrate-1.3-1.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-2bb9364c32

Comment 11 Fedora Update System 2016-02-10 18:50:37 UTC
python-nitrate-1.3-1.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-7474e957a9

Comment 12 Fedora Update System 2016-02-10 23:54:08 UTC
python-nitrate-1.3-1.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-35a106d076

Comment 13 Fedora Update System 2016-02-21 02:22:01 UTC
python-nitrate-1.3-1.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.

Comment 14 Fedora Update System 2016-02-21 16:27:16 UTC
python-nitrate-1.3-1.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.

Comment 15 Fedora Update System 2016-02-27 02:01:02 UTC
python-nitrate-1.3-1.el6 has been pushed to the Fedora EPEL 6 stable repository. If problems still persist, please make note of it in this bug report.

Comment 16 Fedora Update System 2016-02-27 02:07:50 UTC
python-nitrate-1.3-1.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.