A pluggable test expectations management system for WebKit.
webkitexpectationspy provides a unified system for parsing, querying, and linting test expectation files across WebKit's test infrastructure. It supports:
Sonoma+, Ventura-, Monterey-Sonomapip install webkitexpectationspy
Or for development:
cd Tools/Scripts/libraries/webkitexpectationspy pip install -e .
from webkitexpectationspy import ExpectationsManager from webkitexpectationspy.plugins import APITestPlugin # Create manager with API test plugin manager = ExpectationsManager(plugin=APITestPlugin()) # Load expectations file manager.load_file('TestExpectations') # Query expectations exp = manager.get_expectation('TestWebKitAPI.WTF.StringTest') if exp and exp.is_skip(): print('Test is skipped') # Get skipped tests for current configuration skipped = manager.get_skipped_tests( all_tests, current_config={'mac', 'debug', 'arm64'} )
from webkitexpectationspy import ExpectationsManager from webkitexpectationspy.plugins import LayoutTestPlugin # Create manager with layout test plugin manager = ExpectationsManager(plugin=LayoutTestPlugin()) # Load expectations file manager.load_file('LayoutTests/TestExpectations') # Query expectations - supports directory wildcards exp = manager.get_expectation('fast/css/border-radius.html') # Layout test-specific expectations # ImageOnlyFailure, Text, Audio, Leak
# Basic format [bug-ids] [configurations] test-pattern [expectations] # Examples TestWebKitAPI.WTF.StringTest [ Pass ] webkit.org/b/12345 [ mac Sonoma+ ] TestWebKitAPI.WebKit.Bug [ Fail ] rdar://98765 [ ios simulator ] TestWebKitAPI.iOS.Test [ Skip ] [ debug arm64 ] TestWebKitAPI.WTF.* [ Slow:120s ]
+/-/range modifiers| Syntax | Meaning |
|---|---|
Sonoma | Exact version only |
Sonoma+ | This version and later |
Sonoma- | This version and earlier |
Ventura-Sequoia | Inclusive range |
webkit.org/b/12345 - WebKit bug trackerrdar://12345 - Apple RadarBug(identifier) - Other trackers# Lint expectations warnings = manager.lint(all_tests=test_list) for w in warnings: print(w)
The linter checks for:
from webkitexpectationspy.plugins import FormatPlugin class MyTestPlugin(FormatPlugin): @property def name(self): return 'my-tests' @property def expectation_map(self): return { 'pass': 0, 'fail': 1, 'skip': 4, # Add custom expectations } @property def version_tokens(self): return {'v1', 'v2', 'v3'} @property def version_order(self): return ['v1', 'v2', 'v3']
Modified BSD License. See LICENSE file.