tests: Check only the last output lines

This commit is contained in:
Pradyun Gedam 2020-07-27 19:22:15 +05:30
parent 1b2ae22e7b
commit a89ede7da3
No known key found for this signature in database
GPG Key ID: FF99710C4332258E
1 changed files with 5 additions and 3 deletions

View File

@ -3,9 +3,11 @@ from tests.lib import create_test_package_with_setup
def matches_expected_lines(string, expected_lines):
# Ignore empty lines
output_lines = set(filter(None, string.splitlines()))
# Match regardless of order
return set(output_lines) == set(expected_lines)
output_lines = list(filter(None, string.splitlines()))
# We'll match the last n lines, given n lines to match.
last_few_output_lines = output_lines[-len(expected_lines):]
# And order does not matter
return set(last_few_output_lines) == set(expected_lines)
def test_basic_check_clean(script):