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

Fix unorderable types error when sorting slow tests #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sirex
Copy link

@sirex sirex commented Jun 14, 2017

Part, where slow tests are printed, where not cevered with tests. Added tests
for that.

In rare cases, when time of two test cases are the same, sorted function lookes
to the next element of tuple, and next element is test instance which is not
orderable. And that rare case it gives following error:

    Traceback (most recent call last):
      File "CoverageTestRunner.py", line 312, in <module>
          run()
      File "CoverageTestRunner.py", line 303, in run
          result = runner.run()
      File "CoverageTestRunner.py", line 265, in run
          for secs, test in sorted(result.timings)[-10:]:
    TypeError: unorderable types: FooTests() < FooTests()

The fix was to always sort only by time, not by whole tuple.

Part, where slow tests are printed, where not cevered with tests. Added tests
for that.

In rare cases, when time of two test cases are the same, sorted function lookes
to the next element of tuple, and next element is test instance which is not
orderable. And that rare case it gives following error:

    Traceback (most recent call last):
      File "CoverageTestRunner.py", line 312, in <module>
          run()
      File "CoverageTestRunner.py", line 303, in run
          result = runner.run()
      File "CoverageTestRunner.py", line 265, in run
          for secs, test in sorted(result.timings)[-10:]:
    TypeError: unorderable types: FooTests() < FooTests()

The fix was to always sort only by time, not by whole tuple.
Copy link
Member

@mgedmin mgedmin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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

Successfully merging this pull request may close these issues.

2 participants