Skip to content

Commit e645c2a

Browse files
authored
Ignore nondeterministic line ordering in test_commands (#66)
These tests inspect the console output from vcs2l itself, and the order in which the messages appears doesn't appear to be deterministic and can vary by platform, or in some cases, each invocation. Modern Python versions will generally maintain the order in which values are added to a dictionary, which may be a preferable behavior here. Rather than sort the values when they're printed from vcs2l, we can just ignore the ordering in our checks. Signed-off-by: Scott K Logan <logans@cottsay.net>
1 parent f64549a commit e645c2a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/test_commands.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,9 @@ def test_deletion(self):
308308
subfolder='deletion',
309309
)
310310
expected = get_expected_output('delete')
311+
# we don't care what order these messages appear in
312+
output = b'\n'.join(sorted(output.split(b'\n')))
313+
expected = b'\n'.join(sorted(output.split(b'\n')))
311314
self.assertEqual(output, expected)
312315

313316
# check that repositories were actually deleted
@@ -331,6 +334,9 @@ def test_validate(self):
331334

332335
output = run_command('validate', ['--hide-empty', '--input', REPOS_FILE])
333336
expected = get_expected_output('validate_hide')
337+
# we don't care what order these messages appear in
338+
output = b'\n'.join(sorted(output.split(b'\n')))
339+
expected = b'\n'.join(sorted(output.split(b'\n')))
334340
self.assertEqual(output, expected)
335341

336342
output = run_command('validate', ['--input', BAD_REPOS_FILE])

0 commit comments

Comments
 (0)