gecko-dev/tools/tryselect/test/test_fuzzy.py
Andrew Halberstadt 3087b17a69 Bug 1413928 - [tryselect] Implement paths for |mach try fuzzy| r=maja_zf
This enables the syntax like:
./mach try fuzzy dom/indexedDB

This will open up the fzf interface like normal, except only tasks
that have tests under dom/indexedDB will be selectable (and there
will only be one chunk per configuration).

This can be combined with -q/--query like normal:
./mach try fuzzy dom/indexedDB -q "!pgo !cov !asan"

When the tasks get scheduled, only the tests under the specified
path(s) will run within the harness.

MozReview-Commit-ID: IHRXXi5mB4G

--HG--
extra : rebase_source : 8a89f255591e6dfa31b1420196c4698f2015d10c
2017-11-15 16:36:07 -05:00

35 lines
1.0 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 moztest.resolve import TestResolver
from tryselect.selectors import fuzzy
@pytest.fixture
def patch_resolver(monkeypatch):
def inner(suites, tests):
def fake_test_metadata(*args, **kwargs):
return suites, tests
monkeypatch.setattr(TestResolver, 'resolve_metadata', fake_test_metadata)
return inner
def test_filter_by_paths(patch_resolver):
tasks = ['foobar/xpcshell-1', 'foobar/mochitest', 'foobar/xpcshell']
patch_resolver(['xpcshell'], {})
assert fuzzy.filter_by_paths(tasks, 'dummy') == []
patch_resolver([], [{'flavor': 'xpcshell'}])
assert fuzzy.filter_by_paths(tasks, 'dummy') == ['foobar/xpcshell-1', 'foobar/xpcshell']
if __name__ == '__main__':
mozunit.main()