summaryrefslogtreecommitdiffstats
path: root/tools/tryselect/test/test_fuzzy.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /tools/tryselect/test/test_fuzzy.py
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--tools/tryselect/test/test_fuzzy.py54
1 files changed, 54 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..7391745beb
--- /dev/null
+++ b/tools/tryselect/test/test_fuzzy.py
@@ -0,0 +1,54 @@
+# 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/.
+
+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-qr/debug-xpcshell-nofis-",
+ "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-qr/debug-xpcshell-nofis-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-py3"]
+ 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-py3"
+ ]""".lstrip()
+
+ assert expected in output
+
+
+if __name__ == "__main__":
+ mozunit.main()