-
-
Notifications
You must be signed in to change notification settings - Fork 46.5k
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
Tests for odd_even_transposition_parallel #10926
Tests for odd_even_transposition_parallel #10926
Conversation
Your long builds are unique. Did you try running the doctests locally? |
Or you can comment out your tests and see if builds start to work again. |
|
This is what happens when I run it locally with
|
>>> odd_even_transposition(list(range(11)[::-1])) == sorted(list(range(11)[::-1])) | ||
True | ||
>>> odd_even_transposition(["a", "x", "c"]) == sorted(["x", "a", "c"]) | ||
True | ||
>>> odd_even_transposition([1.9, 42.0, 2.8]) == sorted([1.9, 42.0, 2.8]) | ||
True | ||
>>> odd_even_transposition([False, True, False]) == sorted([False, False, True]) | ||
True | ||
>>> odd_even_transposition([1, 32.0, 9]) == sorted([False, False, True]) | ||
False | ||
>>> odd_even_transposition([1, 32.0, 9]) == sorted([1.0, 32, 9.0]) | ||
True | ||
>>> unsorted_list = [-442, -98, -554, 266, -491, 985, -53, -529, 82, -429] | ||
>>> odd_even_transposition(unsorted_list) == sorted(unsorted_list) | ||
True | ||
>>> unsorted_list = [-442, -98, -554, 266, -491, 985, -53, -529, 82, -429] | ||
>>> odd_even_transposition(unsorted_list) == sorted(unsorted_list + [1]) | ||
False | ||
>>> odd_even_transposition([False, "a", 8]) == sorted([False, "a", 8]) | ||
Traceback (most recent call last): | ||
... | ||
TypeError: '>' not supported between instances of 'bool' and 'str' | ||
>>> odd_even_transposition([8, "a"]) == sorted(["a", 8]) | ||
Traceback (most recent call last): | ||
... | ||
TypeError: '<' not supported between instances of 'str' and 'int' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's comment out the doctests and see if the build passes. Then we can add tests one or two at a time until we find the infinite loop.
>>> odd_even_transposition(list(range(11)[::-1])) == sorted(list(range(11)[::-1])) | |
True | |
>>> odd_even_transposition(["a", "x", "c"]) == sorted(["x", "a", "c"]) | |
True | |
>>> odd_even_transposition([1.9, 42.0, 2.8]) == sorted([1.9, 42.0, 2.8]) | |
True | |
>>> odd_even_transposition([False, True, False]) == sorted([False, False, True]) | |
True | |
>>> odd_even_transposition([1, 32.0, 9]) == sorted([False, False, True]) | |
False | |
>>> odd_even_transposition([1, 32.0, 9]) == sorted([1.0, 32, 9.0]) | |
True | |
>>> unsorted_list = [-442, -98, -554, 266, -491, 985, -53, -529, 82, -429] | |
>>> odd_even_transposition(unsorted_list) == sorted(unsorted_list) | |
True | |
>>> unsorted_list = [-442, -98, -554, 266, -491, 985, -53, -529, 82, -429] | |
>>> odd_even_transposition(unsorted_list) == sorted(unsorted_list + [1]) | |
False | |
>>> odd_even_transposition([False, "a", 8]) == sorted([False, "a", 8]) | |
Traceback (most recent call last): | |
... | |
TypeError: '>' not supported between instances of 'bool' and 'str' | |
>>> odd_even_transposition([8, "a"]) == sorted(["a", 8]) | |
Traceback (most recent call last): | |
... | |
TypeError: '<' not supported between instances of 'str' and 'int' | |
# >>> odd_even_transposition(list(range(11)[::-1])) == sorted(list(range(11)[::-1])) | |
True | |
# >>> odd_even_transposition(["a", "x", "c"]) == sorted(["x", "a", "c"]) | |
True | |
# >>> odd_even_transposition([1.9, 42.0, 2.8]) == sorted([1.9, 42.0, 2.8]) | |
True | |
# >>> odd_even_transposition([False, True, False]) == sorted([False, False, True]) | |
True | |
# >>> odd_even_transposition([1, 32.0, 9]) == sorted([False, False, True]) | |
False | |
# >>> odd_even_transposition([1, 32.0, 9]) == sorted([1.0, 32, 9.0]) | |
True | |
>>> unsorted_list = [-442, -98, -554, 266, -491, 985, -53, -529, 82, -429] | |
# >>> odd_even_transposition(unsorted_list) == sorted(unsorted_list) | |
True | |
>>> unsorted_list = [-442, -98, -554, 266, -491, 985, -53, -529, 82, -429] | |
# >>> odd_even_transposition(unsorted_list) == sorted(unsorted_list + [1]) | |
False | |
# >>> odd_even_transposition([False, "a", 8]) == sorted([False, "a", 8]) | |
Traceback (most recent call last): | |
... | |
TypeError: '>' not supported between instances of 'bool' and 'str' | |
# >>> odd_even_transposition([8, "a"]) == sorted(["a", 8]) | |
Traceback (most recent call last): | |
... | |
TypeError: '<' not supported between instances of 'str' and 'int' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just finished pushing all the commits to experiment with. As expected, commenting out all the tests allowed the build to pass. I've made one commit for each test, leaving the rest of the tests commented out except that one. The only exception was the last 3, which were expected to throw exceptions as I couldn't even get those to work locally. If they all fail to build I'm not sure how to proceed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Please uncomment all the tests that work so that they run. Then leave a blank line and then the commented out tests that seem to run forever. I will look at those in my morning. Thanks for your persistence!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That won't be necessary as each test failed individually! I'm not familiar enough with the way Python does parallelization but I suspect that has something to do with why these tests all fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After a lot of trial and error I finally figured it out! It had to do with the globally defined process lock. The only thing I couldn't figure out was how to test for multiple different data types. It threw out multiple exceptions with each of those tests and I couldn't figure out how to get those working in doctest. I tried adding # doctest: +IGNORE_EXCEPTION_DETAIL
as well as playing around with ellipses (...
) to no avail.
For example odd_even_transposition([False, "a", 8]) == sorted([False, "a", 8])
output:
Process Process-47:
Process Process-46:
Traceback (most recent call last):
Traceback (most recent call last):
...
TypeError: '<' not supported between instances of 'str' and 'bool'
TypeError: '>' not supported between instances of 'bool' and 'str'
… odd_even_transposition_parallel_tests
* [ADD] tests for odd_even_transposition_parallel * adding another test because build failed 6 hrs * comment out all tests to see if it fails * list(range(10)[::-1]) test uncommented * [a, x, c] test uncommented * [1.9, 42.0, 2.8] test uncommented * [False, True, False] test uncommented * [1, 32.0, 9] test uncommented * [1, 32.0, 9] test uncommented * [-442, -98, -554, 266, -491, 985, -53, -529, 82, -429] test uncommented * test non global lock * [DEL] Testing multiple data types. Couldn't get doctest to work * [ADD] Comment on why non global process lock
Describe your change:
Contributes to #9943. It should be noted that there is currently a bug in this algo as described in #10925. Will fix in a separate PR after this gets merged.
Checklist: