mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-14 02:31:59 +00:00
14be9536c1
Currently we have the concept of a "suite" and a "flavour" in our task configuration. Typically, the "suite" refers to the high-level test harness like "mochitest" or "reftest", whereas the flavour is more specific, e.g "browser-chrome-instrumentation" or "crashtest". However the line between suite and flavour is not applied with any semblance of consistency which results in inconsistent naming throughout the tree. This patch gets rid of the concept of "flavours" entirely (at least when it comes to task configuration). A suite is a type of test run, for example: - mochitest-plain - mochitest-devtools-chrome - mochitest-browser-chrome-instrumentation - jsreftest - reftest - firefox-ui-functional-remote etc There is no confusion here between suites and flavours because flavours don't exist. However, there are a couple of places where we *do* need to know what "test harness" is used to run a suite. These cases are: 1. For SCHEDULES moz.build rules 2. For the desktop_unittest.py mozharness script which takes arguments like --mochitest-suite=browser (this is not a compelling use of this information and should be refactored to work more like the android_emulator_unittest.py script) So to get this information, this patch introduces a new concept of a "category" which is the overall "test harness" that runs the suite. For many suites, the "category" is identical to the suite name. Unlike flavours, "categories" have no bearing on how we call or refer to the suite. Differential Revision: https://phabricator.services.mozilla.com/D27554 --HG-- extra : moz-landing-system : lando
79 lines
2.3 KiB
Python
79 lines
2.3 KiB
Python
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
from __future__ import absolute_import, print_function, unicode_literals
|
|
|
|
import mozunit
|
|
import pytest
|
|
|
|
from tryselect.selectors.chooser.app import create_application
|
|
|
|
|
|
TASKS = [
|
|
{
|
|
'kind': 'build',
|
|
'label': 'build-windows',
|
|
'attributes': {
|
|
'build_platform': 'windows',
|
|
},
|
|
},
|
|
{
|
|
'kind': 'test',
|
|
'label': 'test-windows-mochitest-e10s',
|
|
'attributes': {
|
|
'unittest_suite': 'mochitest-browser-chrome',
|
|
'mochitest_try_name': 'mochitest-browser-chrome',
|
|
},
|
|
},
|
|
]
|
|
|
|
|
|
@pytest.fixture
|
|
def app(tg):
|
|
app = create_application(tg)
|
|
app.config['TESTING'] = True
|
|
|
|
ctx = app.app_context()
|
|
ctx.push()
|
|
yield app
|
|
ctx.pop()
|
|
|
|
|
|
def test_try_chooser(app):
|
|
client = app.test_client()
|
|
|
|
response = client.get('/')
|
|
assert response.status_code == 200
|
|
|
|
expected_output = [
|
|
"""<title>Try Chooser Enhanced</title>""",
|
|
"""<input class="filter" type="checkbox" id=windows name="build" value='{"build_platform": ["windows"]}' onchange="console.log('checkbox onchange triggered');apply();">""", # noqa
|
|
"""<input class="filter" type="checkbox" id=mochitest-browser-chrome name="test" value='{"unittest_suite": ["mochitest-browser-chrome"]}' onchange="console.log('checkbox onchange triggered');apply();">""", # noqa
|
|
]
|
|
|
|
for expected in expected_output:
|
|
assert expected in response.data
|
|
|
|
response = client.post('/', data={'action': 'Cancel'})
|
|
assert response.status_code == 200
|
|
assert "You may now close this page" in response.data
|
|
assert app.tasks == []
|
|
|
|
response = client.post('/', data={'action': 'Push', 'selected-tasks': ''})
|
|
assert response.status_code == 200
|
|
assert "You may now close this page" in response.data
|
|
assert app.tasks == []
|
|
|
|
response = client.post('/', data={
|
|
'action': 'Push',
|
|
'selected-tasks': 'build-windows\ntest-windows-mochitest-e10s'
|
|
})
|
|
assert response.status_code == 200
|
|
assert "You may now close this page" in response.data
|
|
assert set(app.tasks) == set(['build-windows', 'test-windows-mochitest-e10s'])
|
|
|
|
|
|
if __name__ == '__main__':
|
|
mozunit.main()
|