Skip to content
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

Closed
sgrognard opened this issue Jan 25, 2018 · 3 comments
Closed

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

sgrognard opened this issue Jan 25, 2018 · 3 comments

Comments

@sgrognard
Copy link

Description of problem

for testcase in self.testcases:
  File ".../tcms_api/containers.py", 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

to

        for testcase in self._items:
            yield testcase

naturally "solves" the issue.

@atodorov
Copy link
Member

@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.

@PiotrBorowy
Copy link

I have the same problem with iterating by TestRun.

Api lines for it:

testrun = TestRun(1)
for case in testrun:
print(case)

This throw error:
Traceback (most recent call last):
File "api_test.py", line 52, in
for case in testrun:
File "/usr/local/lib/python3.4/dist-packages/tcms_api/mutable.py", line 508, in iter
for caserun in self.caseruns:
File "/usr/local/lib/python3.4/dist-packages/tcms_api/containers.py", 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
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.
@atodorov
Copy link
Member

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.

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants