зеркало из https://github.com/mozilla/treeherder.git
Bug 1719466 - Alter alert filtering to support macosx (#7203)
This commit is contained in:
Родитель
54be39dc7f
Коммит
1545bf6ccc
|
@ -147,6 +147,15 @@ def test_few_various_alerts():
|
|||
return alerts
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def test_macosx_alert():
|
||||
alert = Mock(spec=PerformanceAlert)
|
||||
platform = 'macosx1015-64-shippable-qr'
|
||||
alert.series_signature.platform.platform = platform
|
||||
alert.is_regression = True
|
||||
return alert
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def test_few_regressions():
|
||||
alerts = [Mock(spec=PerformanceAlert) for _ in range(5)]
|
||||
|
|
|
@ -140,13 +140,16 @@ def test_os_relevance():
|
|||
assert 4 == picker._os_relevance('windows7')
|
||||
assert 3 == picker._os_relevance('linux')
|
||||
assert 2 == picker._os_relevance('osx')
|
||||
assert 2 == picker._os_relevance('macosx') # ensure macosx has the same relevance as osx
|
||||
assert 1 == picker._os_relevance('android')
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
picker._os_relevance('some weird OS')
|
||||
|
||||
|
||||
def test_has_relevant_platform(test_many_various_alerts, test_bad_platform_names):
|
||||
def test_has_relevant_platform(
|
||||
test_many_various_alerts, test_bad_platform_names, test_macosx_alert
|
||||
):
|
||||
picker = AlertsPicker(
|
||||
max_alerts=5,
|
||||
max_improvements=2,
|
||||
|
@ -157,6 +160,7 @@ def test_has_relevant_platform(test_many_various_alerts, test_bad_platform_names
|
|||
assert picker._has_relevant_platform(alert) is True
|
||||
for alert in test_bad_platform_names:
|
||||
assert picker._has_relevant_platform(alert) is False
|
||||
assert picker._has_relevant_platform(test_macosx_alert) is True
|
||||
|
||||
|
||||
def test_extract_by_relevant_platforms(test_many_various_alerts, test_bad_platform_names):
|
||||
|
|
|
@ -136,7 +136,7 @@ class AlertsPicker:
|
|||
:return: int value of platform's relevance
|
||||
"""
|
||||
for platform_of_interest in self.ordered_platforms_of_interest:
|
||||
if alert_platform.startswith(platform_of_interest):
|
||||
if platform_of_interest in alert_platform:
|
||||
return len(
|
||||
self.ordered_platforms_of_interest
|
||||
) - self.ordered_platforms_of_interest.index(platform_of_interest)
|
||||
|
@ -148,7 +148,7 @@ class AlertsPicker:
|
|||
"""
|
||||
alert_platform_name = alert.series_signature.platform.platform
|
||||
return any(
|
||||
alert_platform_name.startswith(platform_of_interest)
|
||||
platform_of_interest in alert_platform_name
|
||||
for platform_of_interest in self.ordered_platforms_of_interest
|
||||
)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче