New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iterating over test cases fails because of no sort key #194

sgrognard opened this Issue Jan 25, 2018 · 3 comments


None yet
3 participants

sgrognard commented Jan 25, 2018

Description of problem

for testcase in self.testcases:
  File ".../tcms_api/", line 796, in __iter__self._items, key=lambda x: self._object.sortkey(x)):
     TypeError: '<' not supported between instances of 'NoneType' and 'NoneType'

Additional info

Since it looks like no sort key is set, modifying

        for testcase in sorted(
                self._items, key=lambda x: self._object.sortkey(x)):
            yield testcase


        for testcase in self._items:
            yield testcase

naturally "solves" the issue.


This comment has been minimized.


atodorov commented Jan 25, 2018

@sgrognard can you post some of your code which calls the API and triggers the problem. We also need to know what data triggers this traceback.


This comment has been minimized.

PiotrBorowy commented Jan 30, 2018

I have the same problem with iterating by TestRun.

Api lines for it:

testrun = TestRun(1)
for case in testrun:

This throw error:
Traceback (most recent call last):
File "", line 52, in
for case in testrun:
File "/usr/local/lib/python3.4/dist-packages/tcms_api/", line 508, in iter
for caserun in self.caseruns:
File "/usr/local/lib/python3.4/dist-packages/tcms_api/", line 958, in iter
for caserun in sorted(self._items, key=lambda x: x.sortkey):
TypeError: unorderable types: NoneType() < int()

It seems like Container do not have sortkey item, and thats why returns NoneType()

atodorov added a commit that referenced this issue Feb 12, 2018

Add test for tcms_api.TestRun. Closes #194
this problem in #194 was solved during the XML-RPC refactoring.
This commit adds the necessary test to demonstrate everything is
working without raising exceptions.

This comment has been minimized.


atodorov commented Feb 12, 2018

This has been fixed during the RPC refactoring released with version 4.0.0. I've just added a test for it and will close this issue once the test is merged.

@atodorov atodorov closed this in 70db635 Feb 13, 2018

asankov added a commit to asankov/Kiwi that referenced this issue Feb 13, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment