This repository has been archived by the owner on Jan 20, 2022. It is now read-only.
Make runner task sorting pay special attention to integers which come be... #26
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,23 @@ | |
) | ||
|
||
|
||
def test_graph_comparator(): | ||
""" | ||
We use a custom comparator to ensure that tasks sort the way we want | ||
by name (if no config is specified) | ||
""" | ||
assert TaskGraph.task_comparator('99-abc', '100-abc') == -1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rail This assertion fails in our current runner for instance. |
||
assert TaskGraph.task_comparator('100-abc', '99-abc') == 1 | ||
assert TaskGraph.task_comparator('99-abc', '99-abc') == 0 | ||
assert TaskGraph.task_comparator('0-bob', '00-jim') == 1 | ||
assert TaskGraph.task_comparator('abcd', '0-abcd') == 1 | ||
assert TaskGraph.task_comparator('abc', 'abc') == 0 | ||
assert TaskGraph.task_comparator('abc', 'def') == -1 | ||
assert TaskGraph.task_comparator('1', '2') == -1 | ||
assert TaskGraph.task_comparator('1', '1') == 0 | ||
assert TaskGraph.task_comparator('2', '1') == 1 | ||
|
||
|
||
def test_graph_ok_no_deps(): | ||
ok = [('a', []), ('z', []), ('y', []), ('0', []), ('9', [])] | ||
graph = TaskGraph(map(TaskConfig.fromtuple, ok)) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think this is very confusing...
00 < 0, but its not the same for 10 vs 010. I believe they will be equal.
I'd rather leave everything as is and just make our task files use consistent number of digits.
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.
We still need a change IMO. I can take out the 00 part, but right now a task prefixed with 100, runs before a task prefixed with 99. Leaving in the split would fix that up.