diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /tools/tryselect/test/test_fuzzy.py | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/tryselect/test/test_fuzzy.py')
-rw-r--r-- | tools/tryselect/test/test_fuzzy.py | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/tools/tryselect/test/test_fuzzy.py b/tools/tryselect/test/test_fuzzy.py new file mode 100644 index 0000000000..55fc01ad99 --- /dev/null +++ b/tools/tryselect/test/test_fuzzy.py @@ -0,0 +1,56 @@ +# 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 os + +import mozunit +import pytest + + +@pytest.mark.skipif(os.name == "nt", reason="fzf not installed on host") +def test_query_paths(run_mach, capfd): + cmd = [ + "try", + "fuzzy", + "--no-push", + "-q", + "^test-linux '64/debug-xpcshell-e10s-", + "caps/tests/unit/test_origin.js", + ] + assert run_mach(cmd) == 0 + + output = capfd.readouterr().out + print(output) + + # If there are more than one tasks here, it means that something went wrong + # with the path filtering. + expected = """ + "tasks": [ + "test-linux1804-64/debug-xpcshell-e10s-1" + ]""".lstrip() + + assert expected in output + + +@pytest.mark.skipif(os.name == "nt", reason="fzf not installed on host") +def test_query(run_mach, capfd): + cmd = ["try", "fuzzy", "--no-push", "-q", "'source-test-python-taskgraph-tests-py2"] + assert run_mach(cmd) == 0 + + output = capfd.readouterr().out + print(output) + + # Should only ever mach one task exactly. + expected = """ + "tasks": [ + "source-test-python-taskgraph-tests-py2" + ]""".lstrip() + + assert expected in output + + +if __name__ == "__main__": + mozunit.main() |