Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py

Issue 1491143003: Linter should enforce Tests marked Slow or WontFix aren't allowed in TestExpectations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (C) 2010 Google Inc. All rights reserved. 1 # Copyright (C) 2010 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 warnings.append('Did not find a test name.') 361 warnings.append('Did not find a test name.')
362 elif state not in ('name_found', 'done'): 362 elif state not in ('name_found', 'done'):
363 warnings.append('Missing a "]"') 363 warnings.append('Missing a "]"')
364 364
365 if 'WONTFIX' in expectations and 'SKIP' not in expectations: 365 if 'WONTFIX' in expectations and 'SKIP' not in expectations:
366 expectations.append('SKIP') 366 expectations.append('SKIP')
367 367
368 if ('SKIP' in expectations or 'WONTFIX' in expectations) and len(set(exp ectations) - set(['SKIP', 'WONTFIX'])): 368 if ('SKIP' in expectations or 'WONTFIX' in expectations) and len(set(exp ectations) - set(['SKIP', 'WONTFIX'])):
369 warnings.append('A test marked Skip or WontFix must not have other e xpectations.') 369 warnings.append('A test marked Skip or WontFix must not have other e xpectations.')
370 370
371 if 'SLOW' in expectations and 'SlowTests' not in filename:
372 warnings.append('SLOW tests should ony be added to SlowTests and not to TestExpectations.')
373
374 if 'WONTFIX' in expectations and ('NeverFixTests' not in filename and 'S taleTestExpectations' not in filename):
375 warnings.append('WONTFIX tests should ony be added to NeverFixTests or StaleTestExpectations and not to TestExpectations.')
376
371 if not expectations and not has_unrecognized_expectation: 377 if not expectations and not has_unrecognized_expectation:
372 warnings.append('Missing expectations.') 378 warnings.append('Missing expectations.')
373 379
374 expectation_line.bugs = bugs 380 expectation_line.bugs = bugs
375 expectation_line.specifiers = specifiers 381 expectation_line.specifiers = specifiers
376 expectation_line.expectations = expectations 382 expectation_line.expectations = expectations
377 expectation_line.name = name 383 expectation_line.name = name
378 expectation_line.warnings = warnings 384 expectation_line.warnings = warnings
379 return expectation_line 385 return expectation_line
380 386
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 # If reconstitute_only_these is an empty list, we want to return ori ginal_string. 1161 # If reconstitute_only_these is an empty list, we want to return ori ginal_string.
1156 # So we need to compare reconstitute_only_these to None, not just ch eck if it's falsey. 1162 # So we need to compare reconstitute_only_these to None, not just ch eck if it's falsey.
1157 if reconstitute_only_these is None or expectation_line in reconstitu te_only_these: 1163 if reconstitute_only_these is None or expectation_line in reconstitu te_only_these:
1158 return expectation_line.to_string(test_configuration_converter) 1164 return expectation_line.to_string(test_configuration_converter)
1159 return expectation_line.original_string 1165 return expectation_line.original_string
1160 1166
1161 def nones_out(expectation_line): 1167 def nones_out(expectation_line):
1162 return expectation_line is not None 1168 return expectation_line is not None
1163 1169
1164 return "\n".join(filter(nones_out, map(serialize, expectation_lines))) 1170 return "\n".join(filter(nones_out, map(serialize, expectation_lines)))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698